ListView.ColumnHeaderCollection.Insert 方法

定義

將資料行行首插入位於指定索引處的集合中。

多載

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

使用指定的對齊文字、索引鍵、寬度和影像索引鍵,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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

使用指定的對齊文字、索引鍵、寬度和影像索引,建立新的資料行行首,並將此行首插入集合中的指定索引處。

Insert(Int32, String, Int32, HorizontalAlignment)

建立新的資料行行首,並且將它插入位於指定索引處的集合中。

Insert(Int32, String, String, Int32)

使用指定的文字、索引鍵和寬度,建立新的資料行行首,並將此行首插入集合中的指定索引處。

Insert(Int32, String, String)

使用指定的文字和索引鍵,建立新的資料行行首,並將此行首插入集合中的指定索引處。

Insert(Int32, String, Int32)

使用指定的文字和初始寬度,建立新的資料行行首,並將此行首插入集合中的指定索引處。

Insert(Int32, ColumnHeader)

將現有的資料行行首插入位於指定索引處的集合中。

Insert(Int32, String)

使用指定的文字,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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

使用指定的對齊文字、索引鍵、寬度和影像索引鍵,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

key
String

資料行行首的名稱。

text
String

顯示於資料行行首中的文字。

width
Int32

資料行行首的初始寬度 (以像素為單位)。

textAlign
HorizontalAlignment

其中一個 HorizontalAlignment 值。

imageKey
String

要在資料行行首中顯示之影像的索引鍵。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行行首陣列加入集合中,請使用 AddRange 方法。

屬性 Name 會對應至 中資料行的 ListView.ColumnHeaderCollection 索引鍵。

適用於

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

使用指定的對齊文字、索引鍵、寬度和影像索引,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

key
String

資料行行首的名稱。

text
String

顯示於資料行行首中的文字。

width
Int32

資料行行首的初始寬度 (以像素為單位)。

textAlign
HorizontalAlignment

其中一個 HorizontalAlignment 值。

imageIndex
Int32

要在資料行行首中顯示之影像的索引。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

屬性 Name 會對應至 中資料行的 ListView.ColumnHeaderCollection 索引鍵。

適用於

Insert(Int32, String, Int32, HorizontalAlignment)

建立新的資料行行首,並且將它插入位於指定索引處的集合中。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

strtext
String

顯示於資料行行首中的文字。

width
Int32

資料行行首的初始寬度。 設定為 -1 可將資料行行首的大小自動調整為資料行中最大子項目文字的大小,或設定為 -2,可將資料行行首的大小自動調整為資料行行首中文字的大小。

textAlign
HorizontalAlignment

其中一個 HorizontalAlignment 值。

例外狀況

index 小於 0,或大於等於 CountListView.ColumnHeaderCollection 屬性值。

備註

這個版本的 Insert 方法可讓您建立具有特定資料行行首文字、寬度和文字對齊設定的新 ColumnHeader ,並將它插入的特定 ListView.ColumnHeaderCollection 位置。 如果您想要將新的資料行標頭插入到現有的資料行標頭集合中,您可以使用這個方法。 如果您想要使用現有的 ColumnHeader ,並將它插入集合中的特定位置,請使用其他版本的 Insert 方法。 若要新增資料行標頭而不指定集合中的特定位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

另請參閱

適用於

Insert(Int32, String, String, Int32)

使用指定的文字、索引鍵和寬度,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

key
String

資料行行首的名稱。

text
String

顯示於資料行行首中的文字。

width
Int32

資料行行首的初始寬度 (以像素為單位)。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

屬性 Name 會對應至 中資料行的 ListView.ColumnHeaderCollection 索引鍵。

適用於

Insert(Int32, String, String)

使用指定的文字和索引鍵,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

key
String

資料行行首的名稱。

text
String

顯示於資料行行首中的文字。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

屬性 Name 會對應至 中資料行的 ListView.ColumnHeaderCollection 索引鍵。

適用於

Insert(Int32, String, Int32)

使用指定的文字和初始寬度,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

text
String

顯示於資料行行首中的文字。

width
Int32

資料行行首的初始寬度 (以像素為單位)。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

適用於

Insert(Int32, ColumnHeader)

將現有的資料行行首插入位於指定索引處的集合中。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

value
ColumnHeader

要插入至集合的 ColumnHeader

例外狀況

index 小於 0,或大於等於 CountListView.ColumnHeaderCollection 屬性值。

備註

這個版本的 Insert 方法可讓您在 中的 ListView.ColumnHeaderCollection 特定位置插入現有的 ColumnHeader

如果您想要建立新的 ColumnHeader ,並將它插入集合中的特定位置,請使用另一個版本的 Insert 方法。 若要新增資料行標頭而不指定集合中的特定位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

另請參閱

適用於

Insert(Int32, String)

使用指定的文字,建立新的資料行行首,並將此行首插入集合中的指定索引處。

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)

參數

index
Int32

插入資料行行首之以零起始的索引位置。

text
String

顯示於資料行行首中的文字。

例外狀況

index 小於 0,或大於等於 CountListView.ColumnHeaderCollection 屬性值。

備註

若要新增資料行標頭而不指定集合中的位置,請使用 Add 方法。 如果您想要將資料行標頭的陣列新增至集合,請使用 AddRange 方法。

適用於