Export (0) Print
Expand All

ListViewItem::Position Property

Gets or sets the position of the upper-left corner of the ListViewItem.

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

[BrowsableAttribute(false)]
public:
property Point Position {
	Point get ();
	void set (Point value);
}

Property Value

Type: System.Drawing::Point
The Point at the upper-left corner of the ListViewItem.

ExceptionCondition
InvalidOperationException

The Position is set when the containing ListView is in virtual mode.

The Position property should be set after the ListViewItem and containing ListView are constructed. Changing the Position property when the containing ListView is in Details or List view will have no effect on the position of the items. Also, the Position property will automatically change when the View property of the containing ListView is changed from SmallIcon, LargeIcon, or Tile view to List or Details. When the ListView is in SmallIcon, LargeIcon, or Tile view, setting the Position property for an item will cause the other items contained in the ListView to be rearranged.

The following code example demonstrates how to use the Position property of a ListViewItem. To run this example, paste the following code into a Windows Form and call the InitializePositionedListViewItems from the form's Load event-handling method. Click the button to see the items repositioned.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 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