• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.ToolStripItemCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ToolStripItemCollection类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripItemCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PopulateItems

        private static void PopulateItems(ToolStripItemCollection items, IEnumerable<CommandMenuGroup> groups, CommandRegistry registry)
        {
            List<CommandMenuGroup> groupList = groups as List<CommandMenuGroup>;
            if (groupList == null)
                groupList = new List<CommandMenuGroup>(groups);

            foreach (CommandMenuGroup group in groupList) {
                if (group != groupList[0])
                    items.Add(new ToolStripSeparator());

                foreach (CommandMenuEntry entry in group) {
                    if (entry.SubMenu != null)
                        items.Add(BuildToolStripMenu(entry.SubMenu, registry));
                    else {
                        CommandRecord record = registry.Lookup(entry.Key);
                        if (record != null) {
                            ToolStripMenuItem menuItem = new ToolStripMenuItem() {
                                Tag = new CommandMenuTag(entry.Key, entry.Param),
                                Text = record.DisplayName,
                                Image = record.Image,
                                ShortcutKeys = record.Shortcut,
                                ShortcutKeyDisplayString = record.ShortcutDisplay,
                                ToolTipText = record.Description,
                            };

                            if (entry.Default)
                                menuItem.Font = new Font(menuItem.Font, menuItem.Font.Style | FontStyle.Bold);

                            items.Add(menuItem);
                        }
                    }
                }
            }
        }
开发者ID:Elof3,项目名称:Treefrog,代码行数:34,代码来源:CommandRegistry.cs


示例2: SetToolStripState

        //////////////////////////////////////////////////////////////////////////
        public void SetToolStripState(ToolStripItemCollection Items)
        {
            foreach(ToolStripItem Item in Items)
            {
                string ActName = Item.Tag as string;
                if (ActName != null)
                {
                    Action.State St = ActContext.GetState(ActName);

                    Item.Enabled = ((St & Action.State.Disabled) != Action.State.Disabled);
                    Item.Visible = ((St & Action.State.Hidden) != Action.State.Hidden);

                    if (Item is ToolStripButton)
                        ((ToolStripButton)Item).Checked = ((St & Action.State.Checked) == Action.State.Checked);
                    else if (Item is ToolStripMenuItem)
                        ((ToolStripMenuItem)Item).Checked = ((St & Action.State.Checked) == Action.State.Checked);

                }

                if(Item is ToolStripDropDownItem)
                {
                    SetToolStripState(((ToolStripDropDownItem)Item).DropDownItems);
                }
            }
        }
开发者ID:segafan,项目名称:wme1_jankavan_tlc_edition-repo,代码行数:26,代码来源:ActionStripBuilder.cs


示例3: FillMenuItems

 private static void FillMenuItems(List<MySQL.Base.MenuItem> itemsBE, ToolStripItemCollection itemsFE)
 {
     foreach (MySQL.Base.MenuItem itemBE in itemsBE)
       {
     switch (itemBE.get_type())
     {
       case MySQL.Base.MenuItemType.MenuSeparator:
     {
       itemsFE.Add(new ToolStripSeparator());
     }
     break;
       default:
     {
       ToolStripMenuItem itemFE = new ToolStripMenuItem();
       itemFE.Tag = itemBE.get_name();
       itemFE.Text = itemBE.get_caption();
       itemFE.Enabled = itemBE.get_enabled();
       if (MySQL.Base.MenuItemType.MenuCascade == itemBE.get_type())
       {
         FillMenuItems(itemBE.get_subitems(), itemFE.DropDownItems);
       }
       else
       {
         itemFE.Click += new EventHandler(OnMenuItemClick);
       }
       itemsFE.Add(itemFE);
     }
     break;
     }
       }
 }
开发者ID:abibell,项目名称:mysql-workbench,代码行数:31,代码来源:WorkbenchToolbarManager.cs


示例4: ToolController

 public ToolController(ToolStripItemCollection collection, Viewport viewport, Project project)
 {
     Tools = collection;
     Viewport = viewport;
     Viewport.Input.MouseClick += ViewportClick;
     Project = project;
 }
开发者ID:Stg3orge,项目名称:P2-Simulering,代码行数:7,代码来源:ToolController.cs


示例5: BuildMenuContentsForGroup

        private static int BuildMenuContentsForGroup(int index, ICommandTarget target, ToolStripItemCollection children, IPoderosaMenuGroup grp) {
            int count = 0;
            foreach (IPoderosaMenu m in grp.ChildMenus) {
                ToolStripMenuItem mi = new ToolStripMenuItem();
                children.Insert(index++, mi); //途中挿入のことも
                mi.DropDownOpening += new EventHandler(OnPopupMenu);
                mi.Enabled = m.IsEnabled(target);
                mi.Checked = mi.Enabled ? m.IsChecked(target) : false;
                mi.Text = m.Text; //Enabledを先に
                mi.Tag = new MenuItemTag(grp, m, target);

                IPoderosaMenuFolder folder;
                IPoderosaMenuItem leaf;
                if ((folder = m as IPoderosaMenuFolder) != null) {
                    BuildMenuContents(mi, folder);
                }
                else if ((leaf = m as IPoderosaMenuItem) != null) {
                    mi.Click += new EventHandler(OnClickMenu);
                    IGeneralCommand gc = leaf.AssociatedCommand as IGeneralCommand;
                    if (gc != null)
                        mi.ShortcutKeyDisplayString = WinFormsUtil.FormatShortcut(CommandManagerPlugin.Instance.CurrentKeyBinds.GetKey(gc));
                }

                count++;
            }

            return count;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:28,代码来源:MenuUtil.cs


示例6: DoHasSeparators

    /// <summary>
    /// Recherche une suite de séparateurs consécutifs
    /// </summary>
    /// <param name="items">collection d'éléments de menus où s'effectue la recherche</param>
    /// <param name="from">index du premier élément à considérer</param>
    /// <param name="start">index du premier séparateur de la suite</param>
    /// <param name="end">index du dernier séparateur de la suite</param>
    /// <returns>true si au moins un séparateur a été trouvé</returns>
    private static bool DoHasSeparators( ToolStripItemCollection items, int from, ref int start, ref int end ) {
      start = from;
      end = start - 1;
      bool found = false;

      // rechercher le premier séparateur
      for (int ix = from ; ix < items.Count ; ix++) {
        if (!(items[ ix ] is ToolStripSeparator)) continue;
        start = ix;
        found = true;
        break;
      }

      // pas de séparateur trouvé
      if (!found) return false;

      // rechercher le dernier séparateur de la suite
      end = start;
      for (int ix = start + 1 ; ix < items.Count ; ix++) {
        if (!(items[ ix ] is ToolStripSeparator)) break;
        end = ix;
      }

      return true;
    }
开发者ID:NicolasR,项目名称:Composants,代码行数:33,代码来源:RegistryStrip.cs


示例7: BuildMenu

 public static void BuildMenu(ToolStripItemCollection items, IEnumerable<IEditorScript> scripts, Func<IEditorScript, Task> callback)
 {
   foreach (var script in scripts)
   {
     if (script.Name.StartsWith("----"))
     {
       items.Add(new ToolStripSeparator());
     }
     else if (script.Children.Any())
     {
       var item = new ToolStripMenuItem(script.Name);
       BuildMenu(item.DropDownItems, script.Children, callback);
       items.Add(item);
     }
     else
     {
       items.Add(new ToolStripMenuItem(script.Name, null, async (s, ev) =>
       {
         var text = await script.GetScript(); // Trigger execution
         if (!string.IsNullOrEmpty(text))
         {
           await callback(script);
         }
       }));
     }
   }
 }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:27,代码来源:EditorScript.cs


示例8: BuildMenu

 public static void BuildMenu(ToolStripItemCollection items, IEnumerable<IEditorScript> scripts, Action<IEditorScript> callback)
 {
   foreach (var script in scripts)
   {
     if (script.Name.StartsWith("----"))
     {
       items.Add(new ToolStripSeparator());
     }
     else if (script.Children.Any())
     {
       var item = new ToolStripMenuItem(script.Name);
       BuildMenu(item.DropDownItems, script.Children, callback);
       items.Add(item);
     }
     else
     {
       items.Add(new ToolStripMenuItem(script.Name, null, (s, ev) =>
       {
         var query = script.Script; // Trigger execution
         if (!string.IsNullOrEmpty(query))
         {
           callback(script);
         }
       }));
     }
   }
 }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:27,代码来源:EditorScript.cs


示例9: WireItems

 internal void WireItems(ToolStripItemCollection collection)
 {
     foreach (System.Windows.Forms.ToolStripItem item in collection)
     {
         ItemAdded(null, new ToolStripItemEventArgs(item));
     }
 }
开发者ID:dbremner,项目名称:cecilstudio,代码行数:7,代码来源:BarControl.cs


示例10: AddMenuItem

 public void AddMenuItem(ToolStripItemCollection collection, int index, String fileName, EventHandler handler)
 {
     ToolStripMenuItem item = new ToolStripMenuItem ();
     item.Text = fileName;
     item.Click += new EventHandler (handler);
     collection.Insert (index, item);
 }
开发者ID:kovacsv,项目名称:RayTracer,代码行数:7,代码来源:History.cs


示例11: 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


示例12: Initialize

 public void Initialize(IMyGenerationMDI mdi, ToolStripItemCollection menuItems)
 {
     this.scintilla.AddShortcuts(menuItems);
     this._fileId = Guid.NewGuid().ToString();
     _mdi = mdi;
     RefreshConnectionInfo();
 }
开发者ID:nguyenhuuhuy,项目名称:mygeneration,代码行数:7,代码来源:SqlToolUserControl.cs


示例13: CreateButton

 private static void CreateButton(ToolStripItemCollection items, string title, EventHandler handler,
     Workitem item)
 {
     var button = new ToolStripMenuItem(title, null, handler);
     items.Add(button);
     button.Tag = item;
 }
开发者ID:versionone,项目名称:V1TaskManager,代码行数:7,代码来源:MainForm.cs


示例14: UpdateControlsForLanguage

 internal static void UpdateControlsForLanguage(ToolStripItemCollection toolStripItems)
 {
     foreach (ToolStripItem i in toolStripItems)
     {
         if (!String.IsNullOrEmpty(Lang.ResourceManager.GetString(i.Name, Lang.Culture)))
             i.Text = Lang.ResourceManager.GetString(i.Name, Lang.Culture);
     }
 }
开发者ID:Jopie64,项目名称:redmine-desktop-client,代码行数:8,代码来源:LangTools.cs


示例15: ToolStripDropDownItem

        protected ToolStripDropDownItem()
            : base()
        {
            _dropDownItems = new ToolStripItemCollection(Parent, null);

            ArrowColor = Color.Black;
            ArrowImage = ApplicationBehaviour.Resources.Images.DropDownRightArrow;
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:8,代码来源:ToolStripItem.cs


示例16: ApplyTo

		public void ApplyTo(ToolStripItemCollection tsic)
		{
			if(tsic == null) throw new ArgumentNullException("tsic");

			Dictionary<string, string> dict = this.ToDictionary();
			if(dict.Count == 0) return;

			this.ApplyTo(tsic, dict);
		}
开发者ID:olivierdagenais,项目名称:testoriented,代码行数:9,代码来源:KPStringTable.cs


示例17: ApplyResources

 public static void ApplyResources(this ComponentResourceManager rm, ToolStripItemCollection items)
 {
     foreach (ToolStripItem item in items)
     {
         rm.ApplyResources(item, item.Name);
         if (item is ToolStripMenuItem)
             ApplyResources(rm, (item as ToolStripMenuItem).DropDownItems);
     }
 }
开发者ID:trttomita,项目名称:hazys-osd,代码行数:9,代码来源:ComponentResourceManagerEx.cs


示例18: AssignPayPalMenuItems

 private void AssignPayPalMenuItems(ToolStripItemCollection dropDownItems)
 {
     dropDownItems.AddRange(new ToolStripItem[]
     {
         donateInUSDollarsToolStripMenuItem,
         donateInEuroToolStripMenuItem,
         donateInGBPToolStripMenuItem
     });
 }
开发者ID:neronotte,项目名称:XrmToolBox,代码行数:9,代码来源:MainForm.Community.cs


示例19: Sort

        public static void Sort(ToolStripItemCollection collection, IComparer comparer)
        {
            ArrayList items = new ArrayList(collection);
            items.Sort(comparer);

            collection.Clear();
            foreach (object itm in items)
                collection.Add(itm as ToolStripItem);
        }
开发者ID:isakkarlsson,项目名称:iphonebackupbrowser-enhanced,代码行数:9,代码来源:Util.cs


示例20: findItem

 private bool findItem(ToolStripMenuItem item, ToolStripItemCollection items)
 {
     foreach (ToolStripItem i in items)
         if (i == item) return true;
         else if (i is ToolStripMenuItem)
         {
             ToolStripMenuItem mi = i as ToolStripMenuItem;
             if (mi.DropDown.Items.Count > 0 && findItem(item, mi.DropDown.Items)) return true;
         }
     return false;
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:11,代码来源:ProjectContextMenu.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.ToolStripItemEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.ToolStripItemClickedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap