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

CPDrawMenuGlyph() public method

public CPDrawMenuGlyph ( Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color, Color backColor ) : void
graphics System.Drawing.Graphics
rectangle System.Drawing.Rectangle
glyph MenuGlyph
color System.Drawing.Color
backColor System.Drawing.Color
return void
		public override void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color, Color backColor) {
			Rectangle	rect;
			int			lineWidth;

			if (backColor != Color.Empty)
				graphics.FillRectangle (ResPool.GetSolidBrush (backColor), rectangle);
				
			Brush brush = ResPool.GetSolidBrush (color);

			switch(glyph) {
			case MenuGlyph.Arrow: {
				float height = rectangle.Height * 0.7f;
				float width  = height / 2.0f;
				
				PointF ddCenter = new PointF (rectangle.X + ((rectangle.Width-width) / 2.0f), rectangle.Y + (rectangle.Height / 2.0f));

				PointF [] vertices = new PointF [3];
				vertices [0].X = ddCenter.X;
				vertices [0].Y = ddCenter.Y - (height / 2.0f);
				vertices [1].X = ddCenter.X;
				vertices [1].Y = ddCenter.Y + (height / 2.0f);
				vertices [2].X = ddCenter.X + width + 0.1f;
				vertices [2].Y = ddCenter.Y;
				
				graphics.FillPolygon (brush, vertices);

				return;
			}

			case MenuGlyph.Bullet: {
				
				lineWidth=Math.Max(2, rectangle.Width/3);
				rect=new Rectangle(rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2);
				
				graphics.FillEllipse(brush, rect);
				
				return;
			}

			case MenuGlyph.Checkmark: {
				
				Pen pen = ResPool.GetPen (color);
				lineWidth = Math.Max (2, rectangle.Width / 6);
				rect = new Rectangle(rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height- lineWidth * 2);

				int Scale = Math.Max (1, rectangle.Width / 12);
				int top = (rect.Y + lineWidth + ((rect.Height - ((2 * Scale) + lineWidth)) / 2));

				for (int i=0; i<lineWidth; i++) {
					graphics.DrawLine (pen, rect.Left+lineWidth/2, top+i, rect.Left+lineWidth/2+2*Scale, top+2*Scale+i);
					graphics.DrawLine (pen, rect.Left+lineWidth/2+2*Scale, top+2*Scale+i, rect.Left+lineWidth/2+6*Scale, top-2*Scale+i);
				}
				return;
			}
			}

		}
ThemeWin32Classic