本文整理匯總了C#中System.Windows.Forms.TreeNodeCollection.MoveNext方法的典型用法代碼示例。如果您正苦於以下問題:C# TreeNodeCollection.MoveNext方法的具體用法?C# TreeNodeCollection.MoveNext怎麽用?C# TreeNodeCollection.MoveNext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.MoveNext方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: EnsureVisible
public void EnsureVisible()
{
if( null == treeView ) return;
TreeView.NodeEnumerator nodes;
int nodeFromTop;
int nodeNo;
while (true)
{
// Find "this" node number and position from the top control.
nodeFromTop = -1;
nodeNo = 0;
bool nodeFound = false;
nodes = new TreeView.NodeEnumerator(treeView.nodes);
while (nodes.MoveNext())
{
if (nodes.currentNode == treeView.topNode)
{
// We are at the top of the control.
nodeFromTop = 0;
}
if (nodes.currentNode == this)
{
if (nodeFromTop < 0)
{
treeView.topNode = this;
treeView.Invalidate();
return;
}
nodeFound = true;
break;
}
if (nodeFromTop >= 0)
{
nodeFromTop++;
}
nodeNo++;
}
if (nodeFound)
{
break;
}
else
{
// Make sure all parents are expanded and see if its now visible.
TreeNode node = this;
TreeNode highestNode = node;
for (; node != null; node = node.Parent)
{
node.expanded = true;
highestNode = node;
}
treeView.InvalidateDown(highestNode);
}
}
int visibleNodes = treeView.VisibleCountActual;
// See if its already visible.
if (nodeFromTop < visibleNodes)
{
return;
}
// Set the top node no we want to make this node 1 up from the bottom.
nodeFromTop = nodeNo - visibleNodes + 1;
if (nodeFromTop < 0)
{
nodeFromTop = 0;
}
// Find the node corresponding to this node no.
nodes.Reset();
nodeNo = 0;
while (nodes.MoveNext())
{
if (nodeFromTop == nodeNo)
{
treeView.topNode = nodes.currentNode;
treeView.Invalidate();
break;
}
nodeNo++;
}
}