Пример #1
0
 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     if (!base.ColorTable.UseSystemColors)
     {
         ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
         if (professionalColorTable != null)
         {
             if (e.ToolStrip is MenuStrip)
             {
                 if (professionalColorTable.MenuItemText != Color.Empty)
                 {
                     e.TextColor = professionalColorTable.MenuItemText;
                 }
             }
             else if (e.ToolStrip is StatusStrip)
             {
                 if (professionalColorTable.StatusStripText != Color.Empty)
                 {
                     e.TextColor = professionalColorTable.StatusStripText;
                 }
             }
             else if (!(e.ToolStrip is ToolStripDropDown) && professionalColorTable.ToolStripText != Color.Empty)
             {
                 e.TextColor = professionalColorTable.ToolStripText;
             }
         }
     }
     base.OnRenderItemText(e);
 }
Пример #2
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (base.ColorTable.UseSystemColors)
     {
         base.OnRenderArrow(e);
     }
     else
     {
         ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
         if (professionalColorTable != null && e.Item.Enabled)
         {
             if (e.Item.Owner is MenuStrip)
             {
                 e.ArrowColor = professionalColorTable.MenuItemText;
             }
             else if (e.Item.Owner is StatusStrip)
             {
                 e.ArrowColor = professionalColorTable.StatusStripText;
             }
             else if (e.Item.Owner.GetType() != typeof(ToolStripDropDownMenu))
             {
                 e.ArrowColor = professionalColorTable.ToolStripText;
             }
         }
         base.OnRenderArrow(e);
     }
 }
Пример #3
0
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderOverflowButtonBackground(e);
            ToolStripItem item = e.Item;

            if (!item.Selected && !item.Pressed)
            {
                ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
                if (professionalColorTable != null)
                {
                    Graphics  graphics = e.Graphics;
                    bool      flag     = item.RightToLeft == RightToLeft.Yes;
                    bool      flag2    = e.ToolStrip.Orientation == Orientation.Horizontal;
                    Rectangle empty    = Rectangle.Empty;
                    empty = (flag ? new Rectangle(0, item.Height - 8, 9, 5) : new Rectangle(item.Width - 12, item.Height - 8, 9, 5));
                    ArrowDirection direction = flag2 ? ArrowDirection.Down : ArrowDirection.Right;
                    int            num       = (!flag || !flag2) ? 1 : (-1);
                    empty.Offset(num, 1);
                    RenderArrowInternal(graphics, empty, direction, professionalColorTable.ToolStripGradientMiddle);
                    empty.Offset(-1 * num, -1);
                    RenderArrowInternal(graphics, empty, direction, professionalColorTable.ToolStripText);
                    if (flag2)
                    {
                        num = (flag ? (-2) : 0);
                        RenderOverflowButtonLine(graphics, professionalColorTable.ToolStripText, empty.Right - 6, empty.Y - 2, empty.Right - 2, empty.Y - 2);
                        RenderOverflowButtonLine(graphics, professionalColorTable.ToolStripGradientMiddle, empty.Right - 5 + num, empty.Y - 1, empty.Right - 1 + num, empty.Y - 1);
                    }
                    else
                    {
                        RenderOverflowButtonLine(graphics, professionalColorTable.ToolStripText, empty.X, empty.Y, empty.X, empty.Bottom - 1);
                        RenderOverflowButtonLine(graphics, professionalColorTable.ToolStripGradientMiddle, empty.X + 1, empty.Y + 1, empty.X + 1, empty.Bottom);
                    }
                }
            }
        }
Пример #4
0
 protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
 {
     if (base.ColorTable.UseSystemColors)
     {
         base.OnRenderDropDownButtonBackground(e);
     }
     else
     {
         ToolStripButton toolStripButton = e.Item as ToolStripButton;
         Rectangle       rectangle       = new Rectangle(Point.Empty, toolStripButton.Size);
         if (!IsZeroWidthOrHeight(rectangle))
         {
             Graphics graphics = e.Graphics;
             ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
             if (professionalColorTable != null)
             {
                 using (new UseAntiAlias(graphics))
                 {
                     Rectangle buttonRectangle = GetButtonRectangle(rectangle);
                     if (toolStripButton.Checked)
                     {
                         DrawButtonBorder(graphics, buttonRectangle, professionalColorTable.ButtonPressedBorder);
                     }
                     if (toolStripButton.Selected && !toolStripButton.Pressed)
                     {
                         RenderButton(graphics, buttonRectangle, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                         DrawButtonBorder(graphics, buttonRectangle, professionalColorTable.ButtonSelectedHighlightBorder);
                     }
                     if (toolStripButton.Pressed)
                     {
                         RenderButton(graphics, buttonRectangle, professionalColorTable.MenuItemPressedGradientBegin);
                         DrawInnerButtonBorder(graphics, buttonRectangle, professionalColorTable.ButtonSelectedHighlightBorder);
                         DrawButtonBorder(graphics, buttonRectangle, professionalColorTable.MenuBorder);
                     }
                 }
             }
             else
             {
                 base.OnRenderDropDownButtonBackground(e);
             }
         }
     }
 }
Пример #5
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (!base.ColorTable.UseSystemColors)
     {
         ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
         if (professionalColorTable != null)
         {
             if (e.Item.Owner.GetType() == typeof(MenuStrip) && !e.Item.Selected && !e.Item.Pressed && professionalColorTable.MenuItemText != Color.Empty)
             {
                 e.ArrowColor = professionalColorTable.MenuItemText;
             }
             if (e.Item.Owner.GetType() == typeof(StatusStrip) && !e.Item.Selected && !e.Item.Pressed && professionalColorTable.StatusStripText != Color.Empty)
             {
                 e.ArrowColor = professionalColorTable.StatusStripText;
             }
         }
     }
     base.OnRenderArrow(e);
 }
Пример #6
0
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripMenuItem toolStripMenuItem = e.Item as ToolStripMenuItem;
            Rectangle         rectangle         = new Rectangle(Point.Empty, toolStripMenuItem.Size);

            if (!IsZeroWidthOrHeight(rectangle))
            {
                Graphics graphics = e.Graphics;
                ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
                if (professionalColorTable != null)
                {
                    using (new UseAntiAlias(graphics))
                    {
                        if (e.ToolStrip is MenuStrip)
                        {
                            if (toolStripMenuItem.Selected && !toolStripMenuItem.Pressed)
                            {
                                RenderMenuItem(graphics, rectangle, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                                ControlPaint.DrawBorder(e.Graphics, rectangle, professionalColorTable.MenuItemTopLevelSelectedBorder, ButtonBorderStyle.Solid);
                            }
                            if (toolStripMenuItem.Pressed)
                            {
                                RenderButton(graphics, rectangle, base.ColorTable.MenuItemPressedGradientBegin);
                                Rectangle bounds = rectangle;
                                bounds.Inflate(-1, -1);
                                ControlPaint.DrawBorder(e.Graphics, bounds, base.ColorTable.ButtonSelectedHighlightBorder, ButtonBorderStyle.Solid);
                                ControlPaint.DrawBorder(e.Graphics, rectangle, base.ColorTable.MenuBorder, ButtonBorderStyle.Solid);
                            }
                        }
                        else
                        {
                            base.OnRenderMenuItemBackground(e);
                        }
                    }
                }
                else
                {
                    base.OnRenderMenuItemBackground(e);
                }
            }
        }
Пример #7
0
 public BseRenderer(ProfessionalColorTable professionalColorTable)
     : base(professionalColorTable)
 {
 }
Пример #8
0
 protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
 {
     if (base.ColorTable.UseSystemColors)
     {
         base.OnRenderDropDownButtonBackground(e);
     }
     else
     {
         ToolStripSplitButton toolStripSplitButton = e.Item as ToolStripSplitButton;
         Rectangle            rectangle            = new Rectangle(Point.Empty, toolStripSplitButton.ButtonBounds.Size);
         if (!IsZeroWidthOrHeight(rectangle))
         {
             Graphics graphics = e.Graphics;
             ProfessionalColorTable professionalColorTable = base.ColorTable as ProfessionalColorTable;
             if (professionalColorTable != null)
             {
                 using (new UseAntiAlias(graphics))
                 {
                     Rectangle buttonRectangle  = GetButtonRectangle(rectangle);
                     Rectangle rectangle2       = new Rectangle(toolStripSplitButton.DropDownButtonBounds.Location, toolStripSplitButton.DropDownButtonBounds.Size);
                     Rectangle buttonRectangle2 = GetButtonRectangle(rectangle2);
                     if (toolStripSplitButton.Selected && !toolStripSplitButton.Pressed && !toolStripSplitButton.ButtonPressed)
                     {
                         RenderButton(graphics, buttonRectangle, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                         RenderButton(graphics, buttonRectangle2, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                         DrawButtonBorder(graphics, buttonRectangle, professionalColorTable.ButtonSelectedHighlightBorder);
                         DrawButtonBorder(graphics, buttonRectangle2, professionalColorTable.ButtonSelectedHighlightBorder);
                     }
                     if (toolStripSplitButton.ButtonPressed)
                     {
                         RenderButton(graphics, buttonRectangle, professionalColorTable.MenuItemPressedGradientBegin);
                         RenderButton(graphics, buttonRectangle2, professionalColorTable.MenuItemPressedGradientBegin);
                         DrawInnerButtonBorder(graphics, buttonRectangle, professionalColorTable.ButtonSelectedHighlightBorder);
                         DrawButtonBorder(graphics, buttonRectangle, professionalColorTable.MenuBorder);
                         DrawInnerButtonBorder(graphics, buttonRectangle2, professionalColorTable.ButtonSelectedHighlightBorder);
                         DrawButtonBorder(graphics, buttonRectangle2, professionalColorTable.MenuBorder);
                     }
                     if (toolStripSplitButton.DropDownButtonPressed)
                     {
                         RenderButton(graphics, buttonRectangle, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                         RenderButton(graphics, buttonRectangle2, professionalColorTable.MenuItemTopLevelSelectedGradientBegin);
                         DrawButtonBorder(graphics, buttonRectangle, base.ColorTable.ButtonSelectedHighlightBorder);
                         DrawButtonBorder(graphics, buttonRectangle2, base.ColorTable.ButtonSelectedHighlightBorder);
                     }
                     if (e.Item.Owner is MenuStrip)
                     {
                         DrawArrow(new ToolStripArrowRenderEventArgs(graphics, toolStripSplitButton, rectangle2, professionalColorTable.MenuItemText, System.Windows.Forms.ArrowDirection.Down));
                     }
                     if (e.Item.Owner is StatusStrip)
                     {
                         DrawArrow(new ToolStripArrowRenderEventArgs(graphics, toolStripSplitButton, rectangle2, professionalColorTable.StatusStripText, System.Windows.Forms.ArrowDirection.Down));
                     }
                     if (e.Item.Owner != null)
                     {
                         DrawArrow(new ToolStripArrowRenderEventArgs(graphics, toolStripSplitButton, rectangle2, professionalColorTable.ToolStripText, System.Windows.Forms.ArrowDirection.Down));
                     }
                 }
             }
             else
             {
                 base.OnRenderDropDownButtonBackground(e);
             }
         }
     }
 }
Пример #9
0
 public Office2007Renderer(ProfessionalColorTable professionalColorTable)
     : base(professionalColorTable)
 {
 }