コード例 #1
0
 /// <summary>
 /// Raises the RenderArrow event.
 /// </summary>
 /// <param name="e">A ToolStripArrowRenderEventArgs that contains the event data.</param>
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (ColorTable.UseSystemColors == false)
     {
         ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
         if (colorTable != null)
         {
             if ((e.Item.Owner.GetType() == typeof(MenuStrip)) && (e.Item.Selected == false) && e.Item.Pressed == false)
             {
                 if (colorTable.MenuItemText != Color.Empty)
                 {
                     e.ArrowColor = colorTable.MenuItemText;
                 }
             }
             if ((e.Item.Owner.GetType() == typeof(StatusStrip)) && (e.Item.Selected == false) && e.Item.Pressed == false)
             {
                 if (colorTable.StatusStripText != Color.Empty)
                 {
                     e.ArrowColor = colorTable.StatusStripText;
                 }
             }
         }
     }
     base.OnRenderArrow(e);
 }
コード例 #2
0
 /// <summary>
 /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderArrow"/> event.
 /// </summary>
 /// <param name="e">
 /// A <see cref="System.Windows.Forms.ToolStripArrowRenderEventArgs"/> that contains the
 /// event data.
 /// </param>
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (ColorTable.UseSystemColors == true)
     {
         base.OnRenderArrow(e);
     }
     else
     {
         ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
         if ((colorTable != null) && (e.Item.Enabled == true))
         {
             if (e.Item.Owner is MenuStrip)
             {
                 e.ArrowColor = colorTable.MenuItemText;
             }
             else if (e.Item.Owner is StatusStrip)
             {
                 e.ArrowColor = colorTable.StatusStripText;
             }
             else
             {
                 if (e.Item.Owner.GetType() != typeof(ToolStripDropDownMenu))
                 {
                     e.ArrowColor = colorTable.ToolStripText;
                 }
             }
         }
         base.OnRenderArrow(e);
     }
 }
コード例 #3
0
 /// <summary>
 /// Raises the RenderItemText event.
 /// </summary>
 /// <param name="e">A ToolStripItemTextRenderEventArgs that contains the event data.</param>
 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     if (ColorTable.UseSystemColors == false)
     {
         ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
         if (colorTable != null)
         {
             if ((e.ToolStrip is MenuStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
             {
                 if (colorTable.MenuItemText != Color.Empty)
                 {
                     e.TextColor = colorTable.MenuItemText;
                 }
             }
             if ((e.ToolStrip is StatusStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
             {
                 if (colorTable.StatusStripText != Color.Empty)
                 {
                     e.TextColor = colorTable.StatusStripText;
                 }
             }
         }
     }
     base.OnRenderItemText(e);
 }
コード例 #4
0
        /// <summary>
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderButtonBackground"/> event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the
        /// event data.
        /// </param>
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            if (ColorTable.UseSystemColors == true)
            {
                base.OnRenderDropDownButtonBackground(e);
            }
            else
            {
                ToolStripButton item         = e.Item as ToolStripButton;
                Rectangle       buttonBounds = new Rectangle(Point.Empty, item.Size);
                if (IsZeroWidthOrHeight(buttonBounds) == true)
                {
                    return;
                }
                Graphics graphics = e.Graphics;
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
                if (colorTable != null)
                {
                    using (UseAntiAlias antiAlias = new UseAntiAlias(graphics))
                    {
                        Rectangle buttonRectangle = GetButtonRectangle(buttonBounds);

                        if (item.Checked == true)
                        {
                            //Draws the border of the button for the checked ToolStripButton control
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonPressedBorder);
                        }
                        if ((item.Selected == true) && (item.Pressed == false))
                        {
                            //Renders the upper button part of the selected ToolStripButton control
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            //Draws the border of the button for the selected ToolStripButton control
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
                            //DrawButtonBorder(graphics, buttonRectangle, Color.FromArgb(196, 194, 196));
                        }
                        if (item.Pressed == true)
                        {
                            //Renders the upper button part of the pressed ToolStripButton control
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemPressedGradientBegin);
                            //Draws the inner border of the button for the pressed ToolStripButton control
                            DrawInnerButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
                            //Draws the outer border of the button for the pressed ToolStripButton control
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.MenuBorder);
                        }
                    }
                }
                else
                {
                    base.OnRenderDropDownButtonBackground(e);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Raises the <see
        /// cref="System.Windows.Forms.ToolStripRenderer.RenderOverflowButtonBackground"/> event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the
        /// event data.
        /// </param>
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderOverflowButtonBackground(e);
            ToolStripItem item = e.Item;

            if ((item.Selected == false) && (item.Pressed == false))
            {
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
                if (colorTable != null)
                {
                    Graphics graphics     = e.Graphics;
                    bool     bRightToLeft = item.RightToLeft == RightToLeft.Yes;

                    bool      bOrientation   = e.ToolStrip.Orientation == Orientation.Horizontal;
                    Rectangle arrowRectangle = Rectangle.Empty;
                    if (bRightToLeft)
                    {
                        arrowRectangle = new Rectangle(0, item.Height - 8, 9, 5);
                    }
                    else
                    {
                        arrowRectangle = new Rectangle(item.Width - 12, item.Height - 8, 9, 5);
                    }

                    ArrowDirection arrowDirection = bOrientation ? ArrowDirection.Down : ArrowDirection.Right;
                    int            x = (bRightToLeft && bOrientation) ? -1 : 1;
                    arrowRectangle.Offset(x, 1);
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripGradientMiddle);
                    arrowRectangle.Offset(-1 * x, -1);
                    RenderArrowInternal(graphics, arrowRectangle, arrowDirection, colorTable.ToolStripText);
                    if (bOrientation)
                    {
                        x = bRightToLeft ? -2 : 0;
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, (int)(arrowRectangle.Right - 6), (int)(arrowRectangle.Y - 2), (int)(arrowRectangle.Right - 2), (int)(arrowRectangle.Y - 2));
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, (int)((arrowRectangle.Right - 5) + x), (int)(arrowRectangle.Y - 1), (int)((arrowRectangle.Right - 1) + x), (int)(arrowRectangle.Y - 1));
                    }
                    else
                    {
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripText, arrowRectangle.X, arrowRectangle.Y, arrowRectangle.X, arrowRectangle.Bottom - 1);
                        RenderOverflowButtonLine(graphics, colorTable.ToolStripGradientMiddle, arrowRectangle.X + 1, arrowRectangle.Y + 1, arrowRectangle.X + 1, arrowRectangle.Bottom);
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Raises the <see cref="System.Windows.Forms.ToolStripRenderer.RenderMenuItemBackground"/> event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the
        /// event data.
        /// </param>
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripMenuItem item   = e.Item as ToolStripMenuItem;
            Rectangle         bounds = new Rectangle(Point.Empty, item.Size);

            if (IsZeroWidthOrHeight(bounds) == true)
            {
                return;
            }
            Graphics graphics = e.Graphics;
            ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;

            if (colorTable != null)
            {
                using (UseAntiAlias useAntiAlias = new UseAntiAlias(graphics))
                {
                    if (e.ToolStrip is MenuStrip)
                    {
                        if ((item.Selected == true) && (item.Pressed == false))
                        {
                            RenderMenuItem(graphics, bounds, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            ControlPaint.DrawBorder(e.Graphics, bounds, colorTable.MenuItemTopLevelSelectedBorder, ButtonBorderStyle.Solid);
                        }
                        if (item.Pressed == true)
                        {
                            RenderButton(graphics, bounds, ColorTable.MenuItemPressedGradientBegin);
                            Rectangle innerBorderRectangle = bounds;
                            innerBorderRectangle.Inflate(-1, -1);
                            ControlPaint.DrawBorder(e.Graphics, innerBorderRectangle, ColorTable.ButtonSelectedHighlightBorder, ButtonBorderStyle.Solid);
                            ControlPaint.DrawBorder(e.Graphics, bounds, ColorTable.MenuBorder, ButtonBorderStyle.Solid);
                        }
                    }
                    else
                    {
                        base.OnRenderMenuItemBackground(e);
                    }
                }
            }
            else
            {
                base.OnRenderMenuItemBackground(e);
            }
        }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the ERenderer class.
 /// </summary>
 /// <param name="professionalColorTable">
 /// A <see cref="EgoDevil.Utilities.UI.EPanels.ProfessionalColorTable"/> to be used for painting.
 /// </param>
 public ERenderer(ProfessionalColorTable professionalColorTable)
     : base(professionalColorTable)
 {
 }
コード例 #8
0
        /// <summary>
        /// Raises the <see
        /// cref="System.Windows.Forms.ToolStripRenderer.OnRenderSplitButtonBackground"/> event.
        /// </summary>
        /// <param name="e">
        /// A <see cref="System.Windows.Forms.ToolStripItemRenderEventArgs"/> that contains the
        /// event data.
        /// </param>
        protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
        {
            if (ColorTable.UseSystemColors == true)
            {
                base.OnRenderDropDownButtonBackground(e);
            }
            else
            {
                ToolStripSplitButton item         = e.Item as ToolStripSplitButton;
                Rectangle            buttonBounds = new Rectangle(Point.Empty, item.ButtonBounds.Size);
                if (IsZeroWidthOrHeight(buttonBounds) == true)
                {
                    return;
                }
                Graphics graphics = e.Graphics;
                ProfessionalColorTable colorTable = ColorTable as ProfessionalColorTable;
                if (colorTable != null)
                {
                    using (UseAntiAlias antiAlias = new UseAntiAlias(graphics))
                    {
                        Rectangle buttonRectangle         = GetButtonRectangle(buttonBounds);
                        Rectangle dropDownButtonBounds    = new Rectangle(item.DropDownButtonBounds.Location, item.DropDownButtonBounds.Size);
                        Rectangle dropDownButtonRectangle = GetButtonRectangle(dropDownButtonBounds);

                        if ((item.Selected == true) && (item.Pressed == false) && (item.ButtonPressed == false))
                        {
                            //Renders the upper button part of the selected ToolStripSplitButton control
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            //Renders the dropDownButton part of the selected ToolStripSplitButton control
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            //Draws the border of the button part for the selected ToolStripSplitButton control
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
                            //Draws the border of the dropDownButton part for the selected ToolStripSplitButton control
                            DrawButtonBorder(graphics, dropDownButtonRectangle, colorTable.ButtonSelectedHighlightBorder);
                        }
                        if (item.ButtonPressed == true)
                        {
                            //Renders the upper button part of the pressed ToolStripSplitButton control
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemPressedGradientBegin);
                            //Renders the dropDownButton part of the pressed ToolStripSplitButton control
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemPressedGradientBegin);
                            //Draws the inner border of the button part for the pressed ToolStripSplitButton control
                            DrawInnerButtonBorder(graphics, buttonRectangle, colorTable.ButtonSelectedHighlightBorder);
                            //Draws the outer border of the button part for the pressed ToolStripSplitButton control
                            DrawButtonBorder(graphics, buttonRectangle, colorTable.MenuBorder);
                            //Draws the inner border of the dropDownButton part for the pressed ToolStripSplitButton control
                            DrawInnerButtonBorder(graphics, dropDownButtonRectangle, colorTable.ButtonSelectedHighlightBorder);
                            //Draws the outer border of the dropDownButton part for the pressed ToolStripSplitButton control
                            DrawButtonBorder(graphics, dropDownButtonRectangle, colorTable.MenuBorder);
                        }
                        if (item.DropDownButtonPressed == true)
                        {
                            //Renders the upper button part of the pressed ToolStripSplitButton control
                            RenderButton(graphics, buttonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            //Renders the dropDownButton part of the pressed ToolStripSplitButton control
                            RenderButton(graphics, dropDownButtonRectangle, colorTable.MenuItemTopLevelSelectedGradientBegin);
                            //Draws the border of the button part for the pressed ToolStripSplitButton control
                            DrawButtonBorder(graphics, buttonRectangle, ColorTable.ButtonSelectedHighlightBorder);
                            //Draws the border of the dropDownButton part for the pressed ToolStripSplitButton control
                            DrawButtonBorder(graphics, dropDownButtonRectangle, ColorTable.ButtonSelectedHighlightBorder);
                        }
                        if (e.Item.Owner is MenuStrip)
                        {
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.MenuItemText, ArrowDirection.Down));
                        }
                        if (e.Item.Owner is StatusStrip)
                        {
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.StatusStripText, ArrowDirection.Down));
                        }
                        if (e.Item.Owner is ToolStrip)
                        {
                            base.DrawArrow(new ToolStripArrowRenderEventArgs(graphics, item, dropDownButtonBounds, colorTable.ToolStripText, ArrowDirection.Down));
                        }
                    }
                }
                else
                {
                    base.OnRenderDropDownButtonBackground(e);
                }
            }
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the Office2007Renderer class.
 /// </summary>
 /// <param name="professionalColorTable">
 /// A <see cref="ProfessionalColorTable"/> to be used for painting.
 /// </param>
 public Office2007Renderer(ProfessionalColorTable professionalColorTable)
     : base(professionalColorTable)
 {
 }