ComponentFactory.Krypton.Toolkit.KryptonOffice2007Renderer.RenderToolButtonBackground C# (CSharp) Method

RenderToolButtonBackground() private method

private RenderToolButtonBackground ( Graphics g, ToolStripButton button, ToolStrip toolstrip ) : void
g System.Drawing.Graphics
button System.Windows.Forms.ToolStripButton
toolstrip System.Windows.Forms.ToolStrip
return void
        private void RenderToolButtonBackground(Graphics g,
                                                ToolStripButton button,
                                                ToolStrip toolstrip)
        {
            // We only draw a background if the item is selected or being pressed
            if (button.Enabled)
            {
                // Ensure we have cached the objects we need
                UpdateCache();

                if (button.Checked)
                {
                    if (button.Pressed)
                        DrawGradientToolItem(g, button, _gradientPressed);
                    else if (button.Selected)
                        DrawGradientToolItem(g, button, _gradientCheckedTracking);
                    else
                        DrawGradientToolItem(g, button, _gradientChecked);
                }
                else
                {
                    if (button.Pressed)
                        DrawGradientToolItem(g, button, _gradientPressed);
                    else if (button.Selected)
                        DrawGradientToolItem(g, button, _gradientTracking);
                }
            }
            else
            {
                if (button.Selected)
                {
                    // 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 (!button.Bounds.Contains(mousePos))
                        DrawGradientToolItem(g, button, _disabledItem);
                }
            }
        }