ListView::AutoResizeColumns Method (ColumnHeaderAutoResizeStyle)
.NET Framework (current version)
Resizes the width of the columns as indicated by the resize style.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- headerAutoResize
-
Type:
System.Windows.Forms::ColumnHeaderAutoResizeStyle
One of the ColumnHeaderAutoResizeStyle values.
| Exception | Condition |
|---|---|
| InvalidOperationException | AutoResizeColumn is called with a value other than None when View is not set to Details. |
The following code example demonstrates initializing a ListView in detail view and automatically resizing the columns using the AutoResizeColumns method. To run this example, paste this code into a Windows Form and call the InitializeResizingListView2 method from the form's constructor or Load event handler.
.NET Framework
Available since 2.0
Available since 2.0
Show: