本文整理汇总了C#中System.Windows.Forms.ListViewItem.SetGroup方法的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem.SetGroup方法的具体用法?C# ListViewItem.SetGroup怎么用?C# ListViewItem.SetGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListViewItem
的用法示例。
在下文中一共展示了ListViewItem.SetGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public ListViewItem Insert (int index, ListViewItem item)
{
if (index < 0 || index > list.Count)
throw new ArgumentOutOfRangeException ("index");
if (owner != null && owner.VirtualMode)
throw new InvalidOperationException ();
if (list.Contains (item))
throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "item");
if (item.ListView != null && item.ListView != owner)
throw new ArgumentException ("Cannot add or insert the item '" + item.Text + "' in more than one place. You must first remove it from its current location or clone it.", "item");
if (is_main_collection)
item.Owner = owner;
else {
if (item.Group != null)
item.Group.Items.Remove (item);
item.SetGroup (group);
}
list.Insert (index, item);
if (is_main_collection || item.ListView != null)
CollectionChanged (true);
// force an update of the selected info if the new item is selected.
if (item.Selected)
item.SetSelectedCore (true);
//UIA Framework event: Item Added
OnUIACollectionChangedEvent (new CollectionChangeEventArgs (CollectionChangeAction.Add, item));
return item;
}
示例2: AddItem
void AddItem (ListViewItem value)
{
if (list.Contains (value))
throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "value");
if (value.ListView != null && value.ListView != owner)
throw new ArgumentException ("Cannot add or insert the item '" + value.Text + "' in more than one place. You must first remove it from its current location or clone it.", "value");
if (is_main_collection)
value.Owner = owner;
else {
if (value.Group != null)
value.Group.Items.Remove (value);
value.SetGroup (group);
}
list.Add (value);
// force an update of the selected info if the new item is selected.
if (value.Selected)
value.SetSelectedCore (true);
}
示例3: AddItem
void AddItem (ListViewItem value)
{
if (list.Contains (value))
throw new ArgumentException ("An item cannot be added more than once. To add an item again, you need to clone it.", "value");
if (value.ListView != null && value.ListView != owner)
throw new ArgumentException ("Cannot add or insert the item '" + value.Text + "' in more than one place. You must first remove it from its current location or clone it.", "value");
if (is_main_collection)
value.Owner = owner;
#if NET_2_0
else {
if (value.Group != null)
value.Group.Items.Remove (value);
value.SetGroup (group);
}
#endif
list.Add (value);
}