Exemple #1
0
        // Render the background of an actual menu bar, dropdown menu or toolbar.
        protected override void OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e)
        {
            if (this.EnsureRenderer())
            {
                if (e.ToolStrip.IsDropDown)
                {
                    this.Renderer.SetParameters(MenuClass, (int)MenuParts.PopupBackground, 0);
                }
                else
                {
                    // It's a MenuStrip or a ToolStrip. If it's contained inside a larger panel, it should have a
                    // transparent background, showing the panel's background.

                    if (e.ToolStrip.Parent is ToolStripPanel)
                    {
                        // The background should be transparent, because the ToolStripPanel's background will be visible.
                        // Of course, we assume the ToolStripPanel is drawn using the same theme, but it's not my fault
                        // if someone does that.
                        return;
                    }
                    else
                    {
                        // A lone toolbar/menubar should act like it's inside a toolbox, I guess.
                        // Maybe I should use the MenuClass in the case of a MenuStrip, although that would break
                        // the other themes...
                        if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.CreateElement(this.RebarClass, RebarBackground, 0)))
                        {
                            this.Renderer.SetParameters(this.RebarClass, RebarBackground, 0);
                        }
                        else
                        {
                            this.Renderer.SetParameters(this.RebarClass, 0, 0);
                        }
                    }
                }

                if (this.Renderer.IsBackgroundPartiallyTransparent())
                {
                    this.Renderer.DrawParentBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.ToolStrip);
                }

                this.Renderer.DrawBackground(e.Graphics, e.ToolStrip.ClientRectangle, e.AffectedBounds);
            }
            else
            {
                base.OnRenderToolStripBackground(e);
            }
        }
 public void DrawStatusStripSizingGrip(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
 }
 public void DrawToolStripBorder(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
 }
 public void DrawImageMargin(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
 }
 public void DrawToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
 }
Exemple #6
0
 protected override void OnRenderToolStripBorder(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
     //base.OnRenderToolStripBorder(e);
 }
Exemple #7
0
 protected override void OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs e)
 {
     //base.OnRenderToolStripBackground(e);
     e.Graphics.FillRectangle(StyleSettings.Brush_Fd_Form, 0, 0, 2000, 2000);
 }