System.Windows.Forms.DrawListViewItemEventArgs Class

Provides data for the ListView.DrawItem event.

See Also: DrawListViewItemEventArgs Members

Syntax

public class DrawListViewItemEventArgs : EventArgs

Remarks

The ListView.DrawItem event enables you to customize the appearance of a System.Windows.Forms.ListView control using owner drawing.

The ListView.DrawItem event is raised by a System.Windows.Forms.ListView control when the ListView.OwnerDraw property is set to true. The System.Windows.Forms.DrawListViewItemEventArgs passed to the event handler contains information about the System.Windows.Forms.ListViewItem to draw and also provides methods to help you draw the item.

Use the DrawListViewItemEventArgs.State or DrawListViewItemEventArgs.Item properties to retrieve information about the item to draw. Use the DrawListViewItemEventArgs.ItemIndex property to retrieve the index of the item.

Use the DrawListViewItemEventArgs.Graphics property to do the actual drawing within the area specified by the DrawListViewItemEventArgs.Bounds property. To draw standard System.Windows.Forms.ListView elements that do not need customization, use the DrawListViewItemEventArgs.DrawBackground, erload:System.Windows.Forms.DrawListViewItemEventArgs.DrawText, and DrawListViewItemEventArgs.DrawFocusRectangle methods.

Note:

To avoid issues with graphics flickering when owner drawing, override the System.Windows.Forms.ListView control and set the ListView.DoubleBuffered property to true. This feature is available only on Windows XP and the Windows Server 2003 family when your application calls the Application.EnableVisualStyles method.

Requirements

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