Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

MenuItem.MeasureItem Event

Occurs when the menu needs to know the size of a menu item before drawing it.

[Visual Basic]
Public Event MeasureItem As MeasureItemEventHandler
[C#]
public event MeasureItemEventHandler MeasureItem;
[C++]
public: __event MeasureItemEventHandler* MeasureItem;

[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives an argument of type MeasureItemEventArgs containing data related to this event. The following MeasureItemEventArgs properties provide information specific to this event.

Property Description
Graphics Gets the Graphics object to measure against.
Index Gets or sets the index of the item for which the height and width is needed.
ItemHeight Gets or sets the height of the item specified by the Index.
ItemWidth Gets or sets the width of the item specified by the Index.

Remarks

In order for this event to be raised, you must have the OwnerDraw property of the menu item set to true. This event is raised before owner drawn menus are drawn to allow for the size of the menu item to be drawn to be specified. For more information about handling events, see Consuming Events.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

MenuItem Class | MenuItem Members | System.Windows.Forms Namespace | OwnerDraw | DrawItem

Show:
© 2015 Microsoft