private void DrawGradientToolSplitItem(Graphics g,
ToolStripSplitButton splitButton,
GradientItemColors colorsButton,
GradientItemColors colorsDrop,
GradientItemColors colorsSplit)
{
// Create entire area and just the drop button area rectangles
Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
Rectangle backRectDrop = splitButton.DropDownButtonBounds;
// Cannot paint zero sized areas
if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
(backRect.Height > 0) && (backRectDrop.Height > 0))
{
// Area that is the normal button starts as everything
Rectangle backRectButton = backRect;
// The X offset to draw the split line
int splitOffset;
// Is the drop button on the right hand side of entire area?
if (backRectDrop.X > 0)
splitOffset = backRectDrop.X;
else
splitOffset = backRectDrop.Right - 1;
// Create border path around the item
using (GraphicsPath borderPath = CreateBorderPath(backRect, _cutMenuItemBack))
{
// Draw the entire background area
DrawGradientBack(g, backRect, colorsButton);
// Draw the split line between the areas
using (Pen splitPen = new Pen(colorsSplit.Border))
g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset, backRect.Bottom - 1);
// Draw the border of the entire item
DrawSolidBorder(g, backRect, colorsButton);
}
}
}