Export (0) Print
Expand All

DrawListViewSubItemEventArgs.DrawText Method (TextFormatFlags)

Draws the text of the ListViewItem.ListViewSubItem using its current foreground color and formatting it with the specified TextFormatFlags values.

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

member DrawText : 
        flags:TextFormatFlags -> unit

Parameters

flags
Type: System.Windows.Forms.TextFormatFlags

A bitwise combination of TextFormatFlags values.

Use this method to draw the subitem text using the current values of the ListViewItem.ListViewSubItem.ForeColor and ListViewItem.ListViewSubItem.Font properties. The text is drawn within the area specified by the Bounds property. The TextFormatFlags values specified in the flags parameter let you provide formatting properties for the node label, such as text alignment.

NoteNote

The UseItemStyleForSubItems property of the parent ListViewItem must be set to false to prevent the ListViewItem.ForeColor and ListViewItem.Font values of the parent item from overriding the subitem values.

The following code example demonstrates how to use the DrawText 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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft