Uređivanje

Dijeli putem


ListView.ColumnHeaderCollection.Insert Method

Definition

Inserts a column header into the collection at the specified index.

Overloads

Insert(Int32, String, String, Int32, HorizontalAlignment, String)

Creates a new column header with the specified aligned text, key, width, and image key, and inserts the header into the collection at the specified index.

Insert(Int32, String, String, Int32, HorizontalAlignment, Int32)

Creates a new column header with the specified aligned text, key, width, and image index, and inserts the header into the collection at the specified index.

Insert(Int32, String, Int32, HorizontalAlignment)

Creates a new column header and inserts it into the collection at the specified index.

Insert(Int32, String, String, Int32)

Creates a new column header with the specified text, key, and width, and inserts the header into the collection at the specified index.

Insert(Int32, String, String)

Creates a new column header with the specified text and key, and inserts the header into the collection at the specified index.

Insert(Int32, String, Int32)

Creates a new column header with the specified text and initial width, and inserts the header into the collection at the specified index.

Insert(Int32, ColumnHeader)

Inserts an existing column header into the collection at the specified index.

Insert(Int32, String)

Creates a new column header with the specified text, and inserts the header into the collection at the specified index.

Insert(Int32, String, String, Int32, HorizontalAlignment, String)

Creates a new column header with the specified aligned text, key, width, and image key, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ key, System::String ^ text, int width, System::Windows::Forms::HorizontalAlignment textAlign, System::String ^ imageKey);
public void Insert (int index, string key, string text, int width, System.Windows.Forms.HorizontalAlignment textAlign, string imageKey);
member this.Insert : int * string * string * int * System.Windows.Forms.HorizontalAlignment * string -> unit
Public Sub Insert (index As Integer, key As String, text As String, width As Integer, textAlign As HorizontalAlignment, imageKey As String)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

key
String

The name of the column header.

text
String

The text to display in the column header.

width
Int32

The initial width, in pixels, of the column header.

textAlign
HorizontalAlignment

One of the HorizontalAlignment values.

imageKey
String

The key of the image to display in the column header.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

The Name property corresponds to the key for a column in the ListView.ColumnHeaderCollection.

Applies to

Insert(Int32, String, String, Int32, HorizontalAlignment, Int32)

Creates a new column header with the specified aligned text, key, width, and image index, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ key, System::String ^ text, int width, System::Windows::Forms::HorizontalAlignment textAlign, int imageIndex);
public void Insert (int index, string key, string text, int width, System.Windows.Forms.HorizontalAlignment textAlign, int imageIndex);
member this.Insert : int * string * string * int * System.Windows.Forms.HorizontalAlignment * int -> unit
Public Sub Insert (index As Integer, key As String, text As String, width As Integer, textAlign As HorizontalAlignment, imageIndex As Integer)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

key
String

The name of the column header.

text
String

The text to display in the column header.

width
Int32

The initial width, in pixels, of the column header.

textAlign
HorizontalAlignment

One of the HorizontalAlignment values.

imageIndex
Int32

The index of the image to display in the column header.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

The Name property corresponds to the key for a column in the ListView.ColumnHeaderCollection.

Applies to

Insert(Int32, String, Int32, HorizontalAlignment)

Creates a new column header and inserts it into the collection at the specified index.

public:
 void Insert(int index, System::String ^ str, int width, System::Windows::Forms::HorizontalAlignment textAlign);
public:
 void Insert(int index, System::String ^ text, int width, System::Windows::Forms::HorizontalAlignment textAlign);
public void Insert (int index, string str, int width, System.Windows.Forms.HorizontalAlignment textAlign);
public void Insert (int index, string text, int width, System.Windows.Forms.HorizontalAlignment textAlign);
member this.Insert : int * string * int * System.Windows.Forms.HorizontalAlignment -> unit
member this.Insert : int * string * int * System.Windows.Forms.HorizontalAlignment -> unit
Public Sub Insert (index As Integer, str As String, width As Integer, textAlign As HorizontalAlignment)
Public Sub Insert (index As Integer, text As String, width As Integer, textAlign As HorizontalAlignment)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

strtext
String

The text to display in the column header.

width
Int32

The initial width of the column header. Set to -1 to autosize the column header to the size of the largest subitem text in the column or -2 to autosize the column header to the size of the text of the column header.

textAlign
HorizontalAlignment

One of the HorizontalAlignment values.

Exceptions

index is less than 0 or greater than or equal to the value of the Count property of the ListView.ColumnHeaderCollection.

Remarks

This version of the Insert method enables you to create a new ColumnHeader with specific column header text, width, and text alignment setting and insert it at a specific position in the ListView.ColumnHeaderCollection. You can use this method if you want to insert a new column header into an existing collection of column headers. If you want to use an existing ColumnHeader and insert it at a specific position in the collection, use the other version of the Insert method. To add a column header without specifying a specific position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

See also

Applies to

Insert(Int32, String, String, Int32)

Creates a new column header with the specified text, key, and width, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ key, System::String ^ text, int width);
public void Insert (int index, string key, string text, int width);
member this.Insert : int * string * string * int -> unit
Public Sub Insert (index As Integer, key As String, text As String, width As Integer)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

key
String

The name of the column header.

text
String

The text to display in the column header.

width
Int32

The initial width, in pixels, of the column header.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

The Name property corresponds to the key for a column in the ListView.ColumnHeaderCollection.

Applies to

Insert(Int32, String, String)

Creates a new column header with the specified text and key, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ key, System::String ^ text);
public void Insert (int index, string key, string text);
member this.Insert : int * string * string -> unit
Public Sub Insert (index As Integer, key As String, text As String)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

key
String

The name of the column header.

text
String

The text to display in the column header.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

The Name property corresponds to the key for a column in the ListView.ColumnHeaderCollection.

Applies to

Insert(Int32, String, Int32)

Creates a new column header with the specified text and initial width, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ text, int width);
public void Insert (int index, string text, int width);
member this.Insert : int * string * int -> unit
Public Sub Insert (index As Integer, text As String, width As Integer)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

text
String

The text to display in the column header.

width
Int32

The initial width, in pixels, of the column header.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

Applies to

Insert(Int32, ColumnHeader)

Inserts an existing column header into the collection at the specified index.

public:
 void Insert(int index, System::Windows::Forms::ColumnHeader ^ value);
public void Insert (int index, System.Windows.Forms.ColumnHeader value);
member this.Insert : int * System.Windows.Forms.ColumnHeader -> unit
Public Sub Insert (index As Integer, value As ColumnHeader)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

value
ColumnHeader

The ColumnHeader to insert into the collection.

Exceptions

index is less than 0 or greater than or equal to the value of the Count property of the ListView.ColumnHeaderCollection.

Remarks

This version of the Insert method enables you to insert an existing ColumnHeader at a specific position in the ListView.ColumnHeaderCollection.

If you want to create a new ColumnHeader and insert it at a specific position in the collection, use the other version of the Insert method. To add a column header without specifying a specific position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

See also

Applies to

Insert(Int32, String)

Creates a new column header with the specified text, and inserts the header into the collection at the specified index.

public:
 void Insert(int index, System::String ^ text);
public void Insert (int index, string text);
member this.Insert : int * string -> unit
Public Sub Insert (index As Integer, text As String)

Parameters

index
Int32

The zero-based index location where the column header is inserted.

text
String

The text to display in the column header.

Exceptions

index is less than 0 or greater than or equal to the value of the Count property of the ListView.ColumnHeaderCollection.

Remarks

To add a column header without specifying a position in the collection, use the Add method. If you want to add an array of column headers to the collection, use the AddRange method.

Applies to