Displays a single column header in a ListView control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
A column header is an item in a ListView control that contains heading text. objects can be added to a ListView using the Add method of the ListView.ColumnHeaderCollection class. To add a group of columns to a ListView, you can use the AddRange method of the ListView.ColumnHeaderCollection class. You can use the Index property of the class to determine where the is located in the ListView.ColumnHeaderCollection.
provides the Text and TextAlign properties to set the text displayed in the control and the alignment of the text in the column header. To determine whether a is associated with a ListView control, you can reference the ListView property. If you want to copy a for use in another ListView control, you can use the Clone method.
The following code example demonstrates initializing a ListView control. The example creates objects and sets the column header's Text, TextAlign and Width properties. The example also adds items and subitems to the ListView. To run this example paste the following code in a form and call the PopulateListView method from the form's constructor or Load event handler.
The example creates ColumnHeader objects and sets the column header's Text, TextAlign and Width properties. The example also adds items and subitems to the ListView. To run this example paste the following code in a form and call the PopulateListView method from the form's constructor or Load method.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.