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


C# TreeNodeCollection.GetEnumerator方法代码示例

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


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

示例1: addSessionMenuItemsFolder

        private void addSessionMenuItemsFolder(ContextMenuStrip cms, ToolStripItemCollection parent, TreeNodeCollection nodes)
        {
            IEnumerator ie = nodes.GetEnumerator();

            while (ie.MoveNext())
            {
                TreeNode node = (TreeNode)ie.Current;
                Session s = (Session)node.Tag;
                if (s.IsFolder)
                {
                    ToolStripMenuItem folder = new ToolStripMenuItem(s.SessionDisplayText);
                    folder.Tag = s;
                    folder.DisplayStyle = ToolStripItemDisplayStyle.Text;
                    // Copy the style of the parent context menu
                    if (folder.DropDown is ToolStripDropDownMenu)
                    {
                        ToolStripDropDownMenu dropDown = folder.DropDown as ToolStripDropDownMenu;
                        dropDown.ShowCheckMargin = cms.ShowCheckMargin;
                        dropDown.ShowImageMargin = cms.ShowImageMargin;
                    }
                    folder.MouseUp += new MouseEventHandler(launchSessionSystrayMenuItem_MouseUp);
                    parent.Add(folder);
                    addSessionMenuItemsFolder(cms, folder.DropDownItems, node.Nodes);
                }
                else
                {
                    ToolStripMenuItem session = new ToolStripMenuItem(s.SessionDisplayText, null, launchSessionSystrayMenuItem_Click);
                    session.Tag = s;
                    session.DisplayStyle = ToolStripItemDisplayStyle.Text;
                    parent.Add(session);
                }
            }
        }
开发者ID:verbitan,项目名称:PuTTY-Session-Manager,代码行数:33,代码来源:SessionTreeControl.cs

示例2: Get_StaticTile

 public StaticTileCollection Get_StaticTile(TreeNodeCollection iTreeNode)
 {
     IEnumerator enumerator = null;
     StaticTileCollection staticTileCollection = new StaticTileCollection();
     staticTileCollection.Clear();
     try
     {
         enumerator = iTreeNode.GetEnumerator();
         while (enumerator.MoveNext())
         {
             TreeNode current = (TreeNode)enumerator.Current;
             staticTileCollection.Add(new Transition.StaticTile(ShortType.FromObject(current.Tag), 0));
         }
     }
     finally
     {
         if (enumerator is IDisposable)
         {
             ((IDisposable)enumerator).Dispose();
         }
     }
     return staticTileCollection;
 }
开发者ID:HankTheDrunk,项目名称:ultimaonlinemapcreator,代码行数:23,代码来源:TransitionWizard.cs

示例3: FindByKey

        public TreeNode FindByKey(TreeNodeCollection nodes, string key)
        {
            if( nodes.Count == 0 )
                return null;

            if (TestList.InvokeRequired == true)
            {
                return (TreeNode)this.Invoke(new FindNodeByKeyCB(FindByKey), new object[] { nodes, key });
            }
            IEnumerator itr = nodes.GetEnumerator();
            while( itr.MoveNext() == true )
            {
                TreeNodeTag tag = (TreeNodeTag)((TreeNode)itr.Current).Tag;
                if( tag.key == key )
                    return (TreeNode)itr.Current;
            }
            return null;
        }
开发者ID:powerumc,项目名称:vutpp,代码行数:18,代码来源:UnitTestBrowser.cs


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