System.Windows.Forms.DrawListViewSubItemEventArgs Class

Provides data for the ListView.DrawSubItem event.

See Also: DrawListViewSubItemEventArgs Members

Syntax

public class DrawListViewSubItemEventArgs : EventArgs

Remarks

The ListView.DrawSubItem event enables you to customize (or owner-draw) the appearance of a System.Windows.Forms.ListView control in the details view.

The ListView.DrawSubItem event is raised by a System.Windows.Forms.ListView control when its ListView.OwnerDraw property is set to true and its ListView.View property is set to View.Details. The System.Windows.Forms.DrawListViewSubItemEventArgs passed to the event handler contains information about the System.Windows.Forms.ListViewItem.ListViewSubItem to draw and also provides methods to help you draw the subitem.

Use the DrawListViewSubItemEventArgs.ItemState or DrawListViewSubItemEventArgs.Item properties to retrieve information about the parent item of the subitem to draw. To retrieve the System.Windows.Forms.ListViewItem.ListViewSubItem itself, use the DrawListViewSubItemEventArgs.SubItem property. Use the DrawListViewSubItemEventArgs.Header property to retrieve the System.Windows.Forms.ColumnHeader representing the header of the column in which the subitem is displayed.

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

Use the DrawListViewSubItemEventArgs.DrawDefault property when you want the operating system to draw the subitem. This is useful when you want to customize only specific subitems.

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