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


C# ToolStripItemCollection.Cast方法代码示例

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


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

示例1: AssertHasNoMenuWithText

		/// <summary>
		/// Assert that the strip has no menu item with the specified text.
		/// </summary>
		/// <param name="items"></param>
		/// <param name="text"></param>
		/// <returns></returns>
		private static void AssertHasNoMenuWithText(ToolStripItemCollection items, string text)
		{
			if (items.Cast<ToolStripItem>().Any(item => item is ToolStripMenuItem && (item as ToolStripMenuItem).Text == text))
			{
				Assert.Fail("item " + text + " was unexpectedly found in a context menu");
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:13,代码来源:InMemoryLogicTest.cs

示例2: ActualItems

 private IEnumerable<ToolStripItem> ActualItems(ToolStripItemCollection items)
 {
     return items.Cast<ToolStripItem>().Where(item => !(item is ToolStripSeparator));
 }
开发者ID:xeno-by,项目名称:datavault,代码行数:4,代码来源:CommandMapping.cs

示例3: CloneItems

 private List<ToolStripItem> CloneItems(ToolStripItemCollection collection)
 {
     var list = new List<ToolStripItem>();
     if (collection != null)
     {
         list.Add(new ToolStripSeparator());
         var enumerable = collection.Cast<ToolStripItem>();
         foreach (var toolStripItem in enumerable)
         {
             if (toolStripItem is ToolStripSeparator)
             {
                 list.Add(new ToolStripSeparator());
             }
             else
             {
                 var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                 if (toolStripMenuItem != null)
                 {
                     var item = new ToolStripMenuItem
                     {
                         Name = toolStripMenuItem.Name,
                         Size = toolStripMenuItem.Size,
                         Text = toolStripMenuItem.Text,
                         ToolTipText = toolStripMenuItem.ToolTipText,
                         ShortcutKeys = toolStripMenuItem.ShortcutKeys,
                         ShortcutKeyDisplayString = toolStripMenuItem.ShortcutKeyDisplayString,
                         ShowShortcutKeys = toolStripMenuItem.ShowShortcutKeys
                     };
                     var events = (EventHandlerList)eventsPropertyInfo.GetValue(toolStripMenuItem, null);
                     var secret = eventClickFieldInfo.GetValue(null);
                     var handlers = events[secret];
                     events = (EventHandlerList)eventsPropertyInfo.GetValue(item, null);
                     events.AddHandler(secret, handlers);
                     list.Add(item);
                 }
             }
         }
     }
     return list;
 }
开发者ID:MWKStudios,项目名称:ServiceBusExplorer,代码行数:40,代码来源:MainForm.cs

示例4: FindOrCreateAlgoMenuItem

        private static ToolStripMenuItem FindOrCreateAlgoMenuItem(ToolStripItemCollection parent, string algorithm)
        {
            ToolStripMenuItem algoItem = parent.Cast<ToolStripMenuItem>().FirstOrDefault(item => item.Text.Equals(algorithm));

            if (algoItem == null)
            {
                algoItem = new ToolStripMenuItem()
                {
                    Text = algorithm
                };
                parent.Add(algoItem);
            }

            return algoItem;
        }
开发者ID:27miller87,项目名称:MultiMiner,代码行数:15,代码来源:MinerForm.cs


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