System.Windows.Forms.ListBox.DrawItem Event

Occurs when a visual aspect of an owner-drawn System.Windows.Forms.ListBox changes.

Syntax

public event DrawItemEventHandler DrawItem

Remarks

This event is used by an owner-drawn System.Windows.Forms.ListBox. The event is only raised when the ListBox.DrawMode property is set to DrawMode.OwnerDrawFixed or DrawMode.OwnerDrawVariable. You can use this event to perform the tasks needed to draw items in the System.Windows.Forms.ListBox. If you have a variable-sized item (when the ListBox.DrawMode property is set to DrawMode.OwnerDrawVariable), before drawing an item, the ListBox.MeasureItem event is raised. You can create an event handler for the ListBox.MeasureItem event to specify the size for the item that you are going to draw in your event handler for the ListBox.DrawItem event.

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