示例#1
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 BSE.Windows.Forms.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);
     }
 }
示例#2
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (currentRenderer != null)
         currentRenderer.DrawArrow(e);
     else
         base.OnRenderArrow(e);
 }
        /// <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 XiaoCai.WinformUI.Panels.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);
        }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if(e.Item.Enabled)
         e.ArrowColor = Color.Black;
     else
         e.ArrowColor = SystemColors.GrayText;
     base.OnRenderArrow(e);
 }
示例#5
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (e.Item.Enabled)
     {
         e.ArrowColor = FORE_COLOR;
     }
     base.OnRenderArrow(e);
 }
示例#6
0
 protected override void OnRenderArrow(System.Windows.Forms.ToolStripArrowRenderEventArgs e)
 {
     if (currentRenderer != null)
     {
         currentRenderer.DrawArrow(e);
         return;
     }
     base.OnRenderArrow(e);
 }
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            if (!e.Item.Selected && !e.Item.Pressed)
            {
                e.ArrowColor = ColorScheme.ColorGray89;
            }

            base.OnRenderArrow(e);
        }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     ToolStripDropDownItem item = e.Item as ToolStripDropDownItem;
     if (!(((item == null) || (e.Direction != ArrowDirection.Down)) || item.DropDown.Visible))
     {
         e.Direction = ArrowDirection.Right;
     }
     base.OnRenderArrow(e);
 }
 /// <summary>
 /// 绘制 ToolStripItem 上的箭头。
 /// </summary>
 /// <param name="e"></param>
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     Graphics g = e.Graphics;
     Image arrow = AssemblyHelper.GetImage("QQ.ContextMenu.menu_arrow.png");
     Rectangle imgPoint = new Rectangle(
         e.ArrowRectangle.X + 4,
         (e.ArrowRectangle.Height - arrow.Height) / 2,
         arrow.Width,
         arrow.Height);//图片的位置和显示的大小
     Rectangle imgRect = new Rectangle(0, 0, arrow.Width, arrow.Height);
     g.DrawImage(arrow, imgPoint, imgRect, GraphicsUnit.Pixel);
 }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     ToolStripSplitButton item = e.Item as ToolStripSplitButton;
     if (!((e.Item is ToolStripMenuItem) || !((item != null) ? item.ButtonPressed : e.Item.Pressed)))
     {
         Rectangle arrowRectangle = e.ArrowRectangle;
         arrowRectangle.Offset(1, 1);
         e.ArrowRectangle = arrowRectangle;
     }
     if (!e.Item.Enabled)
     {
         e.ArrowColor = SystemColors.GrayText;
     }
     base.OnRenderArrow(e);
 }
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            try
            {
                e.ArrowRectangle = Rectangle.Inflate(e.ArrowRectangle, 5, -2);

                if (e.Direction == ArrowDirection.Down)
                    e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_arrow_down, e.ArrowRectangle);
                else if (e.Direction == ArrowDirection.Up)
                    e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_arrow_up, e.ArrowRectangle);
                else if (e.Direction == ArrowDirection.Left)
                    e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_arrow_left, e.ArrowRectangle);
                else if (e.Direction == ArrowDirection.Right)
                    e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_arrow_right, e.ArrowRectangle);

                //e.Graphics.FillRectangle(Brushes.Red, e.ArrowRectangle);
            }
            catch
            {
                base.OnRenderArrow(e);
            }
        }
示例#12
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     renderer.DrawArrow(e);
 }
		public void DrawArrow (ToolStripArrowRenderEventArgs e)
		{ this.OnRenderArrow (e); }
示例#14
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     e.ArrowColor = Theme.Standard.RendererColorTable.Arrow;
     base.OnRenderArrow(e);
 }
示例#15
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     e.ArrowColor = e.Item.Enabled ? clrTxt : clrGray;
     base.OnRenderArrow(e);
 }
示例#16
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     using (var bmp = Bitmaps.Load("Arrow"))
         e.Graphics.DrawImage(bmp, new Point(e.Item.Bounds.Width - 10, e.ArrowRectangle.Y + 7));
 }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     e.ArrowColor = Color.FromArgb(0x00, 0x79, 0xcb);
       base.OnRenderArrow(e);
 }
示例#18
0
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            e.ArrowColor = itemColor;

            base.OnRenderArrow(e);
        }
示例#19
0
 public void DrawArrow(ToolStripArrowRenderEventArgs e)
 {
     this.OnRenderArrow(e);
 }
示例#20
0
 /// <summary>
 /// 渲染箭头
 /// </summary>
 /// <param name="e"></param>
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     //e.ArrowColor = Color.Red;//设置为红色,当然还可以 画出各种形状
     //base.OnRenderArrow(e);
 }
        /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderArrow"]/*' />
        protected virtual void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            if (RendererOverride != null)
            {
                RendererOverride.OnRenderArrow(e);
                return;
            }
            Graphics  g            = e.Graphics;
            Rectangle dropDownRect = e.ArrowRectangle;

            using (Brush brush = new SolidBrush(e.ArrowColor)) {
                Point middle = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2);
                // if the width is odd - favor pushing it over one pixel right.
                //middle.X += (dropDownRect.Width % 2);

                Point[] arrow = null;

                // We need the Elvis operator here, since at design time at this point Item can be null.
                if (e.Item?.DeviceDpi != previousDeviceDpi && DpiHelper.EnableToolStripPerMonitorV2HighDpiImprovements)
                {
                    previousDeviceDpi = e.Item.DeviceDpi;
                    ScaleArrowOffsetsIfNeeded(e.Item.DeviceDpi);
                }
                else
                {
                    ScaleArrowOffsetsIfNeeded();
                }

                // using (offset4X - Offset2X) instead of (Offset2X) to compensate for rounding error in scaling
                int horizontalOffset = DpiHelper.EnableToolStripHighDpiImprovements ? offset4X - Offset2X : Offset2X;

                switch (e.Direction)
                {
                case ArrowDirection.Up:

                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y + 1),
                        new Point(middle.X + Offset2X + 1, middle.Y + 1),
                        new Point(middle.X, middle.Y - Offset2Y)
                    };

                    break;

                case ArrowDirection.Left:
                    arrow = new Point[] {
                        new Point(middle.X + Offset2X, middle.Y - offset4Y),
                        new Point(middle.X + Offset2X, middle.Y + offset4Y),
                        new Point(middle.X - horizontalOffset, middle.Y)
                    };

                    break;

                case ArrowDirection.Right:
                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y - offset4Y),
                        new Point(middle.X - Offset2X, middle.Y + offset4Y),
                        new Point(middle.X + horizontalOffset, middle.Y)
                    };

                    break;

                case ArrowDirection.Down:
                default:
                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y - 1),
                        new Point(middle.X + Offset2X + 1, middle.Y - 1),
                        new Point(middle.X, middle.Y + Offset2Y)
                    };
                    break;
                }
                g.FillPolygon(brush, arrow);
            }
        }
		protected override void OnRenderArrow (ToolStripArrowRenderEventArgs e)
		{
			base.OnRenderArrow (e);
		}
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            if (e.Item is ToolStripMenuItem && e.Item.Selected)
            {
                e.ArrowColor = ColorTable.MenuText;
            }

            base.OnRenderArrow(e);
        }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     e.Direction = ArrowDirection.Right;
     base.OnRenderArrow(e);
 }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (Conversions.InHighContrastMode() && e.Item.Selected)
     e.ArrowColor = Color.White;
       else
     e.ArrowColor = Color.Black;
       base.OnRenderArrow(e);
 }
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     base.OnRenderArrow(e);
 }
示例#27
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     this.renderer.DrawArrow(e);
 }
 /// <summary>Override - see base.</summary>
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     // The default renderer will draw an arrow for us (the UXTheme API seems not to have one for all directions),
     // but it will get the colour wrong in many cases. The text colour is probably the best colour to use.
     if (EnsureRenderer())
         e.ArrowColor = GetItemTextColor(e.Item);
     base.OnRenderArrow(e);
 }
示例#29
0
        /// <summary>
        ///     Raises the RenderArrow event.
        /// </summary>
        /// <param name="e"> An ToolStripArrowRenderEventArgs containing the event data. </param>
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            // Cannot paint a zero sized area
            if ((e.ArrowRectangle.Width > 0) &&
                (e.ArrowRectangle.Height > 0))
            {
                // Create a path that is used to fill the arrow
                using (GraphicsPath arrowPath = this.CreateArrowPath(e.Item,
                                                                     e.ArrowRectangle,
                                                                     e.Direction))
                {
                    // Get the rectangle that encloses the arrow and expand slightly
                    // so that the gradient is always within the expanding bounds
                    RectangleF boundsF = arrowPath.GetBounds();
                    boundsF.Inflate(1f, 1f);

                    Color color1 = (e.Item.Enabled ? _arrowLight : _arrowDisabled);
                    Color color2 = (e.Item.Enabled ? _arrowDark : _arrowDisabled);

                    float angle = 0;

                    // Use gradient angle to match the arrow direction
                    switch (e.Direction)
                    {
                        case ArrowDirection.Right:
                            angle = 0;
                            break;
                        case ArrowDirection.Left:
                            angle = 180f;
                            break;
                        case ArrowDirection.Down:
                            angle = 90f;
                            break;
                        case ArrowDirection.Up:
                            angle = 270f;
                            break;
                    }

                    // Draw the actual arrow using a gradient
                    using (LinearGradientBrush arrowBrush = new LinearGradientBrush(boundsF, color1, color2, angle))
                        e.Graphics.FillPath(arrowBrush, arrowPath);
                }
            }
        }
        protected virtual void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            if (this.RendererOverride != null)
            {
                this.RendererOverride.OnRenderArrow(e);
            }
            else
            {
                Graphics graphics = e.Graphics;
                Rectangle arrowRectangle = e.ArrowRectangle;
                using (Brush brush = new SolidBrush(e.ArrowColor))
                {
                    Point point = new Point(arrowRectangle.Left + (arrowRectangle.Width / 2), arrowRectangle.Top + (arrowRectangle.Height / 2));
                    Point[] points = null;
                    switch (e.Direction)
                    {
                        case ArrowDirection.Left:
                            points = new Point[] { new Point(point.X + 2, point.Y - 4), new Point(point.X + 2, point.Y + 4), new Point(point.X - 2, point.Y) };
                            break;

                        case ArrowDirection.Up:
                            points = new Point[] { new Point(point.X - 2, point.Y + 1), new Point(point.X + 3, point.Y + 1), new Point(point.X, point.Y - 2) };
                            break;

                        case ArrowDirection.Right:
                            points = new Point[] { new Point(point.X - 2, point.Y - 4), new Point(point.X - 2, point.Y + 4), new Point(point.X + 2, point.Y) };
                            break;

                        default:
                            points = new Point[] { new Point(point.X - 2, point.Y - 1), new Point(point.X + 3, point.Y - 1), new Point(point.X, point.Y + 2) };
                            break;
                    }
                    graphics.FillPolygon(brush, points);
                }
            }
        }
示例#31
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     int itemState = (int)(e.Item.Enabled ? NativeMethods.POPUPSUBMENUSTATES.MSM_NORMAL :
     NativeMethods.POPUPSUBMENUSTATES.MSM_DISABLED);
        using (Bitmap backBmp = new Bitmap(e.ArrowRectangle.Width, e.ArrowRectangle.Height))
        {
     using (Graphics backGfx = Graphics.FromImage(backBmp))
     {
      IntPtr hDC = backGfx.GetHdc();
      Rectangle backRect = new Rectangle(new Point(0, 0), backBmp.Size);
      NativeMethods.DrawThemeBackground(hTheme, hDC,
       (int)NativeMethods.MENUPARTS.MENU_POPUPSUBMENU, itemState,
       ref backRect, ref backRect);
      backGfx.ReleaseHdc();
     }
     e.Graphics.DrawImageUnscaled(backBmp, e.ArrowRectangle);
        }
 }
示例#32
0
 /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.DrawArrow"]/*' />
 public void DrawArrow(ToolStripArrowRenderEventArgs e) {            
     OnRenderArrow(e);
     
     ToolStripArrowRenderEventHandler eh = Events[EventRenderArrow] as ToolStripArrowRenderEventHandler;
     if (eh != null) {
         eh(this, e);
     }        
 }
		protected virtual void OnRenderArrow (ToolStripArrowRenderEventArgs e)
		{
			switch (e.Direction) {
				case ArrowDirection.Down:
					using (Pen p = new Pen (e.ArrowColor)) {
						int x = e.ArrowRectangle.Left + (e.ArrowRectangle.Width / 2) - 3;
						int y = e.ArrowRectangle.Top + (e.ArrowRectangle.Height / 2) - 2;

						DrawDownArrow (e.Graphics, p, x, y);
					}
					break;
				case ArrowDirection.Left:
					break;
				case ArrowDirection.Right:
					using (Pen p = new Pen (e.ArrowColor)) {
						int x = e.ArrowRectangle.Left + (e.ArrowRectangle.Width / 2) - 3;
						int y = e.ArrowRectangle.Top + (e.ArrowRectangle.Height / 2) - 4;

						DrawRightArrow (e.Graphics, p, x, y);
					}
					break;
				case ArrowDirection.Up:
					break;
			}
			
			ToolStripArrowRenderEventHandler eh = (ToolStripArrowRenderEventHandler)Events[RenderArrowEvent];
			if (eh != null)
				eh (this, e);
		}
示例#34
0
 protected virtual void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     throw null;
 }
 public void DrawArrow(ToolStripArrowRenderEventArgs e)
 {
     this.OnRenderArrow(e);
     ToolStripArrowRenderEventHandler handler = this.Events[EventRenderArrow] as ToolStripArrowRenderEventHandler;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            Graphics  g            = e.Graphics;
            Rectangle dropDownRect = e.ArrowRectangle;
            Color     color        = GetThemeColor("ToolStripItem.ArrowColor");

            if (!e.Item.Enabled)
            {
                e.ArrowColor = SystemColors.GrayText;
            }
            else if (color != Color.Empty)
            {
                e.ArrowColor = color;
            }
            else
            {
                e.ArrowColor = SystemColors.MenuText;
            }
            using (Brush brush = new SolidBrush(e.ArrowColor))
            {
                Point[] arrow;
                Int32   hor    = ScaleHelper.Scale(2);
                Int32   ver    = ScaleHelper.Scale(2);
                Point   middle = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2);
                switch (e.Direction)
                {
                case ArrowDirection.Up:
                    arrow = new Point[]
                    {
                        new Point(middle.X - hor, middle.Y + 1),
                        new Point(middle.X + hor + 1, middle.Y + 1),
                        new Point(middle.X, middle.Y - ver)
                    };
                    break;

                case ArrowDirection.Left:
                    arrow = new Point[]
                    {
                        new Point(middle.X + hor, middle.Y - 2 * ver),
                        new Point(middle.X + hor, middle.Y + 2 * ver),
                        new Point(middle.X - hor, middle.Y)
                    };
                    break;

                case ArrowDirection.Right:
                    arrow = new Point[]
                    {
                        new Point(middle.X - hor, middle.Y - 2 * ver),
                        new Point(middle.X - hor, middle.Y + 2 * ver),
                        new Point(middle.X + hor, middle.Y)
                    };
                    break;

                case ArrowDirection.Down:
                default:
                    arrow = new Point[]
                    {
                        new Point(middle.X - hor, middle.Y - 1),
                        new Point(middle.X + hor + 1, middle.Y - 1),
                        new Point(middle.X, middle.Y + ver)
                    };
                    break;
                }
                g.FillPolygon(brush, arrow);
            }
        }
示例#37
0
        protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            e.ArrowColor = Colors.LightText;
            e.ArrowRectangle = new Rectangle(new Point(e.ArrowRectangle.Left, e.ArrowRectangle.Top - 1), e.ArrowRectangle.Size);

            base.OnRenderArrow(e);
        }
示例#38
0
            protected override void OnRenderArrow(System.Windows.Forms.ToolStripArrowRenderEventArgs e)
            {
                e.ArrowColor = Color.Black;

                base.OnRenderArrow(e);
            }
        /// <summary>
        /// Disables split button highlighting while mousing over 
        /// a split button when the app doesn't have focus. 
        /// </summary>
        /// <param name="Args">The event holding the split button to render.</param>
        protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs Args)
        {
            if ( AppHasFocus() )
            {
                base.OnRenderSplitButtonBackground(Args);
            }
            else
            {
                ToolStripSplitButton SplitButton = Args.Item as ToolStripSplitButton;
                ToolStripArrowRenderEventArgs DrawArrowEvent = new ToolStripArrowRenderEventArgs(	Args.Graphics,
                                                                                                    SplitButton,
                                                                                                    SplitButton.DropDownButtonBounds,
                                                                                                    SplitButton.BackColor,
                                                                                                    ArrowDirection.Down);

                // If we don't do draw the down arrow while the form doesn't have focus, the arrow will
                // disappear as the user hovers over the split button while the app is not focused.
                base.DrawArrow(DrawArrowEvent);
            }
        }
示例#40
0
        /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderArrow"]/*' />
        protected virtual void OnRenderArrow(ToolStripArrowRenderEventArgs e)
        {
            if (RendererOverride != null)
            {
                RendererOverride.OnRenderArrow(e);
                return;
            }
            Graphics  g            = e.Graphics;
            Rectangle dropDownRect = e.ArrowRectangle;

            using (Brush brush = new SolidBrush(e.ArrowColor)) {
                Point middle = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2);
                // if the width is odd - favor pushing it over one pixel right.
                //middle.X += (dropDownRect.Width % 2);

                Point[] arrow = null;

                ScaleArrowOffsetsIfNeeded();

                // using (offset4X - Offset2X) instead of (Offset2X) to compensate for rounding error in scaling
                int horizontalOffset = DpiHelper.IsScalingRequirementMet ? offset4X - Offset2X : Offset2X;

                switch (e.Direction)
                {
                case ArrowDirection.Up:

                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y + 1),
                        new Point(middle.X + Offset2X + 1, middle.Y + 1),
                        new Point(middle.X, middle.Y - Offset2Y)
                    };

                    break;

                case ArrowDirection.Left:
                    arrow = new Point[] {
                        new Point(middle.X + Offset2X, middle.Y - offset4Y),
                        new Point(middle.X + Offset2X, middle.Y + offset4Y),
                        new Point(middle.X - horizontalOffset, middle.Y)
                    };

                    break;

                case ArrowDirection.Right:
                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y - offset4Y),
                        new Point(middle.X - Offset2X, middle.Y + offset4Y),
                        new Point(middle.X + horizontalOffset, middle.Y)
                    };

                    break;

                case ArrowDirection.Down:
                default:
                    arrow = new Point[] {
                        new Point(middle.X - Offset2X, middle.Y - 1),
                        new Point(middle.X + Offset2X + 1, middle.Y - 1),
                        new Point(middle.X, middle.Y + Offset2Y)
                    };
                    break;
                }
                g.FillPolygon(brush, arrow);
            }
        }
示例#41
0
        /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderArrow"]/*' />
        protected virtual void OnRenderArrow(ToolStripArrowRenderEventArgs e){

            if (RendererOverride != null) {
               RendererOverride.OnRenderArrow(e);
               return;
            }
            Graphics g = e.Graphics;
            Rectangle dropDownRect = e.ArrowRectangle;
            using (Brush brush = new SolidBrush(e.ArrowColor)) {
             
                 Point middle = new Point(dropDownRect.Left + dropDownRect.Width / 2, dropDownRect.Top + dropDownRect.Height / 2);
                 // if the width is odd - favor pushing it over one pixel right.
                 //middle.X += (dropDownRect.Width % 2);

                 Point[] arrow = null;

                 ScaleArrowOffsetsIfNeeded();
                 switch (e.Direction) {
                     case ArrowDirection.Up:
                         
                         arrow = new Point[] {
                                 new Point(middle.X - Offset2X, middle.Y + Offset1Y),
                                 new Point(middle.X + Offset3X, middle.Y + Offset1Y),
                                 new Point(middle.X, middle.Y - Offset2Y)};
                             
                         break;
                     case ArrowDirection.Left:
                         arrow = new Point[] {
                                 new Point(middle.X + Offset2X, middle.Y - Offset4Y),
                                 new Point(middle.X + Offset2X, middle.Y + Offset4Y),
                                 new Point(middle.X - Offset2X, middle.Y)};
                                 
                         break;
                     case ArrowDirection.Right:
                         arrow = new Point[] {
                                 new Point(middle.X - Offset2X, middle.Y - Offset4Y),
                                 new Point(middle.X - Offset2X, middle.Y + Offset4Y),
                                 new Point(middle.X + Offset2X, middle.Y)};
                                     
                         break;
                     case ArrowDirection.Down:
                     default:
                         arrow = new Point[] {
                             new Point(middle.X - Offset2X, middle.Y - Offset1Y),
                             new Point(middle.X + Offset3X, middle.Y - Offset1Y),
                             new Point(middle.X, middle.Y + Offset2Y) };
                         break;
                 }
                 g.FillPolygon(brush, arrow);
            }
        }
示例#42
0
 public void DrawArrow(ToolStripArrowRenderEventArgs e)
 {
     throw null;
 }