private void RenderToolDropButtonBackground(Graphics g,
ToolStripItem item,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (item.Selected || item.Pressed)
{
if (item.Enabled)
{
if (item.Pressed)
DrawContextMenuHeader(g, item);
else
{
// Ensure we have cached the objects we need
UpdateCache();
DrawGradientToolItem(g, item, _gradientTracking);
}
}
else
{
// Get the mouse position in tool strip coordinates
Point mousePos = toolstrip.PointToClient(Control.MousePosition);
// If the mouse is not in the item area, then draw disabled
if (!item.Bounds.Contains(mousePos))
DrawGradientToolItem(g, item, _disabledGradientItem);
}
}
}