DrawListViewSubItemEventArgs.DrawFocusRectangle Method

Note: This method is new in the .NET Framework version 2.0.

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

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public void DrawFocusRectangle (
	Rectangle bounds
public void DrawFocusRectangle (
	Rectangle bounds
public function DrawFocusRectangle (
	bounds : Rectangle



The area within which to draw the focus rectangle.

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 ListView control when the ListView.FullRowSelect property is set to false. To draw the focus rectangle around the first subitem, call the DrawFocusRectangle method only when the ColumnIndex value is 0.

The 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.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0