System.Windows.Forms.ListBox.MeasureItem Event

Occurs when an owner-drawn System.Windows.Forms.ListBox is created and the sizes of the list items are determined.

Syntax

public event MeasureItemEventHandler MeasureItem

Remarks

You can create an event handler for this event to specify the size an item will be made before it is drawn in the ListBox.DrawItem event. The event is only raised when the ListBox.DrawMode property is set to DrawMode.OwnerDrawVariable.

The maximum valid height of a System.Windows.Forms.ListBox item is 255 pixels. Setting the MeasureItemEventArgs.ItemHeight property of the System.Windows.Forms.MeasureItemEventArgs to a value greater than 255 when handling this event may yield unexpected results.

For more information about handling events, see Consuming Events.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0