NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MenuItem DrawItem Event

Occurs when when the property of a menu item is set to true and a request is made to draw the menu item.

The following declaration shows the syntax for a method that handles the DrawItem event.

[Visual Basic]
Private Sub MenuItemName_DrawItem( _
   ByVal sender As Object, _
   ByVal e As DrawItemEventArgs _
)
[C#]
private void MenuItemName_DrawItem(
   object sender,
   DrawItemEventArgs e
);
[C++]
private: void MenuItemName_DrawItem(
   Object* sender,
   DrawItemEventArgs* e
);
[JScript]
private MenuItemName_DrawItem(
   sender : Object,
   e : DrawItemEventArgs
);

Parameters

sender
The source of the event.
e
A DrawItemEventArgs that contains the event data. The following DrawItemEventArgs properties provide information specific to this event.
Property Description
Bounds
The rectangle outlining the area in which the painting should be done.
Font
A suggested font, usually the parent control's Font property.
ForeColor
A suggested color drawing: either SystemColors.WindowText or SystemColors.HighlightText, depending on whether this item is selected.
Graphics
Graphics object with which painting should be done.
Index
The index of the item that should be painted.
State
Miscellaneous state information, such as whether the item is "selected", "focused", or some other such information. ComboBoxes have one special piece of information which indicates if the item being painted is the editable portion of the ComboBox.

Remarks

The DrawItemEventArgs argument passed to a OnDrawItem event handler provides a System.Drawing.Advanced.Graphics object that allows you to peform drawing and other graphical operations on the surface of the menu item. You can use this event handler to create custom menus that meet the needs of your application.

See Also

MenuItem Class | MenuItem MembersTopic | System.WinForms Namespace