private void RenderItemInternal(ToolStripItemRenderEventArgs e)
{
ToolStripItem item = e.Item;
Graphics dc = e.Graphics;
ToolBarState toolBarState = GetToolBarState(item);
VisualStyleElement normal = VisualStyleElement.ToolBar.Button.Normal;
if (ToolStripManager.VisualStylesEnabled && System.Windows.Forms.VisualStyles.VisualStyleRenderer.IsElementDefined(normal))
{
System.Windows.Forms.VisualStyles.VisualStyleRenderer visualStyleRenderer = VisualStyleRenderer;
visualStyleRenderer.SetParameters(normal.ClassName, normal.Part, (int)toolBarState);
visualStyleRenderer.DrawBackground(dc, new Rectangle(Point.Empty, item.Size));
}
else
{
this.RenderSmall3DBorderInternal(dc, new Rectangle(Point.Empty, item.Size), toolBarState, item.RightToLeft == RightToLeft.Yes);
}
Rectangle contentRectangle = item.ContentRectangle;
if (item.BackgroundImage != null)
{
ControlPaint.DrawBackgroundImage(dc, item.BackgroundImage, item.BackColor, item.BackgroundImageLayout, contentRectangle, contentRectangle);
}
else
{
ToolStrip currentParent = item.GetCurrentParent();
if (((currentParent != null) && (toolBarState != ToolBarState.Checked)) && (item.BackColor != currentParent.BackColor))
{
FillBackground(dc, contentRectangle, item.BackColor);
}
}
}