本文整理汇总了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);
}
}
}
示例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;
}
示例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;
}