private void RenderToolSplitButtonBackground(Graphics g,
ToolStripSplitButton splitButton,
ToolStrip toolstrip)
{
// We only draw a background if the item is selected or being pressed
if (splitButton.Selected || splitButton.Pressed)
{
if (splitButton.Enabled)
{
// Ensure we have cached the objects we need
UpdateCache();
if (!splitButton.Pressed && splitButton.ButtonPressed)
DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientTracking, _gradientSplit);
else if (splitButton.Pressed && !splitButton.ButtonPressed)
DrawContextMenuHeader(g, splitButton);
else
DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientSplit);
}
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 (!splitButton.Bounds.Contains(mousePos))
DrawGradientToolItem(g, splitButton, _disabledItem);
}
}
}