System.Windows.Forms.ListView.AutoResizeColumn Method

Resizes the width of the given column as indicated by the resize style.

Syntax

public void AutoResizeColumn (int columnIndex, ColumnHeaderAutoResizeStyle headerAutoResize)

Parameters

columnIndex
The zero-based index of the column to resize.
headerAutoResize
One of the System.Windows.Forms.ColumnHeaderAutoResizeStyle values.

Remarks

Calling this method is only effective once the System.Windows.Forms.ListView and containing System.Windows.Forms.Form have been constructed, and the System.Windows.Forms.ListView column headers and columns are populated with items. If new items are added to the System.Windows.Forms.ListView, the columns will not resize unless ListView.AutoResizeColumn(int, ColumnHeaderAutoResizeStyle) is called again.

Requirements

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