Provides data for the ListView.DrawItem event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
|DrawListViewItemEventArgs(Graphics, ListViewItem, Rectangle, Int32, ListViewItemStates)|
Initializes a new instance of theclass.
Gets the size and location of the ListViewItem to draw.
Gets the ListViewItem to draw.
Gets the current state of the ListViewItem to draw.
Draws the background of the ListViewItem using its current background color.
Draws a focus rectangle for the ListViewItem if it has focus.
Draws the text of the ListViewItem using its current foreground color.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Returns a string that represents the current object.(Inherited from Object.)
The ListView.DrawItem event is raised by a ListView control when the ListView.OwnerDraw property is set to true. The passed to the event handler contains information about the ListViewItem to draw and also provides methods to help you draw the item.
Use the Graphics property to do the actual drawing within the area specified by the Bounds property. To draw standard ListView elements that do not need customization, use the DrawBackground, DrawText, and DrawFocusRectangle methods.
The following code example demonstrates how to provide custom drawing for a ListView control. The ListView control in the example has a gradient background. Subitems with negative values have a red foreground and a black background.
A handler for the ListView.DrawItem event draws the background for entire items. A handler for the ListView.DrawSubItem event draws the text values and both the text and background for subitems that have negative values. A handler for the DrawColumnHeader event draws each column header.
A ContextMenu component provides a way to switch between the details view and the list view. In the list view, only the ListView.DrawItem event is fired. In this case, the text and background are both drawn in the ListView.DrawItem event handler.
Available since 2.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.