ListViewGroupCollection.Add 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
為收藏增添 a ListViewGroup 。
多載
| 名稱 | Description |
|---|---|
| Add(ListViewGroup) |
將指定的 ListViewGroup 資料加入集合。 |
| Add(String, String) |
使用指定的值ListViewGroupName為 and 屬性初始化,新增一個Header新集合。 |
Add(ListViewGroup)
將指定的 ListViewGroup 資料加入集合。
public:
int Add(System::Windows::Forms::ListViewGroup ^ group);
public int Add(System.Windows.Forms.ListViewGroup group);
member this.Add : System.Windows.Forms.ListViewGroup -> int
Public Function Add (group As ListViewGroup) As Integer
參數
- group
- ListViewGroup
ListViewGroup加入收藏。
傳回
集合中該群組的索引,或 -1 若群組已存在則索引。
例外狀況
group 包含至少一個 ListViewItem 屬於 ListView 非擁有該控制 ListViewGroupCollection的控制。
這個收藏被分配到的 是 ListView 虛擬模式。
備註
使用此方法將現有 ListViewGroup 檔案加入收藏。 你不能將 a ListViewGroup 加入收藏超過一次。 當你用集合中已有的 a Add 呼叫ListViewGroup該方法時,加法失敗,-1 會被回傳。
要在集合中新增多個群組,請使用此 AddRange 方法。
另請參閱
適用於
Add(String, String)
使用指定的值ListViewGroupName為 and 屬性初始化,新增一個Header新集合。
public:
System::Windows::Forms::ListViewGroup ^ Add(System::String ^ key, System::String ^ headerText);
public System.Windows.Forms.ListViewGroup Add(string key, string headerText);
public System.Windows.Forms.ListViewGroup Add(string? key, string? headerText);
member this.Add : string * string -> System.Windows.Forms.ListViewGroup
Public Function Add (key As String, headerText As String) As ListViewGroup
參數
傳回
新的 ListViewGroup.
例外狀況
這個收藏被分配到的 是 ListView 虛擬模式。