System.Windows.Forms.ThemeWin32Classic.DrawToolBarDropDownArrow C# (CSharp) Method

DrawToolBarDropDownArrow() protected method

protected DrawToolBarDropDownArrow ( Graphics dc, System.Windows.Forms.ToolBarItem item, bool is_flat ) : void
dc System.Drawing.Graphics
item System.Windows.Forms.ToolBarItem
is_flat bool
return void
		protected virtual void DrawToolBarDropDownArrow (Graphics dc, ToolBarItem item, bool is_flat)
		{
			Rectangle rect = item.Rectangle;
			rect.X = item.Rectangle.Right - ToolBarDropDownWidth;
			rect.Width = ToolBarDropDownWidth;
			
			if (is_flat) {
				if (item.DDPressed)
					CPDrawBorder3D (dc, rect, Border3DStyle.SunkenOuter, all_sides);
				else if (item.Button.Pushed || item.Pressed)
					CPDrawBorder3D (dc, rect, Border3DStyle.SunkenOuter, all_sides);
				else if (item.Hilight)
					CPDrawBorder3D (dc, rect, Border3DStyle.RaisedInner, all_sides);
			} else {
				if (item.DDPressed)
					CPDrawBorder3D (dc, rect, Border3DStyle.Flat, all_sides);
				else if (item.Button.Pushed || item.Pressed)
					CPDrawBorder3D (dc, Rectangle.Inflate(rect, -1, -1), Border3DStyle.SunkenOuter, all_sides);
				else
					CPDrawBorder3D (dc, rect, Border3DStyle.Raised, all_sides);
			}
			
			PointF [] vertices = new PointF [3];
			PointF ddCenter = new PointF (rect.X + (rect.Width/2.0f), rect.Y + (rect.Height / 2));
			
			// Increase vertical and horizontal position by 1 when button is pressed
			if (item.Pressed || item.Button.Pushed || item.DDPressed) {
			    ddCenter.X += 1;
			    ddCenter.Y += 1;
			}
			
			vertices [0].X = ddCenter.X - ToolBarDropDownArrowWidth / 2.0f + 0.5f;
			vertices [0].Y = ddCenter.Y;
			vertices [1].X = ddCenter.X + ToolBarDropDownArrowWidth / 2.0f + 0.5f;
			vertices [1].Y = ddCenter.Y;
			vertices [2].X = ddCenter.X + 0.5f; // 0.5 is added for adjustment
			vertices [2].Y = ddCenter.Y + ToolBarDropDownArrowHeight;
			dc.FillPolygon (SystemBrushes.ControlText, vertices);
		}
ThemeWin32Classic