System.Windows.Forms.DrawListViewSubItemEventArgs.DrawFocusRectangle Method

Draws a focus rectangle for the System.Windows.Forms.ListViewItem.ListViewSubItem if the parent System.Windows.Forms.ListViewItem has focus.

Syntax

public void DrawFocusRectangle (System.Drawing.Rectangle bounds)

Parameters

bounds
The area within which to draw the focus rectangle.

Remarks

Use this method to draw a standard focus rectangle around the subitem. The focus rectangle is drawn one pixel inside the area specified by the bounds parameter. It is drawn only when the parent item has focus, so you do not need to check the focus state of the item before you call this method.

You might want to draw the focus rectangle only around the first subitem (that is, the parent item, which is displayed in the first column) rather than drawing it around every subitem of an item. This corresponds to the normal behavior of a System.Windows.Forms.ListView control when the ListView.FullRowSelect property is set to false. To draw the focus rectangle around the first subitem, call the DrawListViewSubItemEventArgs.DrawFocusRectangle(System.Drawing.Rectangle) method only when the DrawListViewSubItemEventArgs.ColumnIndex value is 0.

The System.Windows.Forms.ListView control does not provide the ability to select individual subitems, but if you want to implement subitem selection yourself, you can use this method to draw the focus rectangle around a subitem other than the first one.

Requirements

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