ControlPaint.DrawMenuGlyph Method (Graphics, Int32, Int32, Int32, Int32, MenuGlyph, Color, Color)

Draws the specified menu glyph on a menu item control within the specified coordinates, height, and width on the specified surface, replacing White with the color specified in the backColor parameter and replacing Black with the color specified in the foreColor parameter.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public static void DrawMenuGlyph (
	Graphics graphics,
	int x,
	int y,
	int width,
	int height,
	MenuGlyph glyph,
	Color foreColor,
	Color backColor
)
public static void DrawMenuGlyph (
	Graphics graphics, 
	int x, 
	int y, 
	int width, 
	int height, 
	MenuGlyph glyph, 
	Color foreColor, 
	Color backColor
)
public static function DrawMenuGlyph (
	graphics : Graphics, 
	x : int, 
	y : int, 
	width : int, 
	height : int, 
	glyph : MenuGlyph, 
	foreColor : Color, 
	backColor : Color
)
Not applicable.

Parameters

graphics

The Graphics to draw on.

x

The x-coordinate of the upper left corner of the drawing rectangle.

y

The y-coordinate of the upper left corner of the drawing rectangle.

width

The width of the menu glyph.

height

The height of the menu glyph.

glyph

One of the MenuGlyph values that specifies the image to draw.

foreColor

The color that replaces White as the foreground color.

backColor

The color that replaces Black as the background color.

When owner-drawing MenuItem controls, you need to verify property values to determine the correct glyph to draw or remove. For example, when the MenuItem.Checked property is set to true, you must call the Checkmark value of MenuGlyph to draw a check mark on the MenuItem.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: