当前位置: 首页>>代码示例>>C#>>正文


C# ListViewItem.SetSelectedCore方法代码示例

本文整理汇总了C#中System.Windows.Forms.ListViewItem.SetSelectedCore方法的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem.SetSelectedCore方法的具体用法?C# ListViewItem.SetSelectedCore怎么用?C# ListViewItem.SetSelectedCore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ListViewItem的用法示例。


在下文中一共展示了ListViewItem.SetSelectedCore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
			}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:22,代码来源:ListView.cs

示例2: 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;
			}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:36,代码来源:ListView.cs


注:本文中的System.Windows.Forms.ListViewItem.SetSelectedCore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。