DrawListViewSubItemEventArgs::DrawBackground Method ()
Draws the background of the ListViewItem::ListViewSubItem using its current background color.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Use this method to draw a standard background that uses the current value of the ListViewItem::ListViewSubItem::BackColor property. The background is drawn to fill the area specified by the Bounds property.
Note |
|---|
The UseItemStyleForSubItems property of the parent ListViewItem must be set to false to prevent the ListViewItem::BackColor value of the parent item from overriding the subitem value. |
The following code example demonstrates how to use the DrawBackground method in an application that provides custom drawing for a ListView control. In the example, a handler for the ListView::DrawSubItem event draws the subitem text values and both the text and background for subitems that have negative values.
For the complete example, see the DrawListViewSubItemEventArgs overview reference topic.
Available since 2.0
