本文整理汇总了C#中System.Windows.Forms.TreeNodeCollection.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.CopyTo方法的具体用法?C# TreeNodeCollection.CopyTo怎么用?C# TreeNodeCollection.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.CopyTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SortNodes
public void SortNodes(TreeNodeCollection nodes, bool recursive)
{
if (!isSorted) {
return;
}
TreeNode[] nodeArray = new TreeNode[nodes.Count];
nodes.CopyTo(nodeArray, 0);
Array.Sort(nodeArray, nodeSorter);
nodes.Clear();
nodes.AddRange(nodeArray);
if (recursive) {
foreach (TreeNode childNode in nodeArray) {
SortNodes(childNode.Nodes, true);
}
}
}
示例2: SetSelection
public bool SetSelection(object value, TreeNodeCollection nodes)
{
TreeNode[] nodeArray;
if (nodes == null)
{
nodeArray = new TreeNode[base.Nodes.Count];
base.Nodes.CopyTo(nodeArray, 0);
}
else
{
nodeArray = new TreeNode[nodes.Count];
nodes.CopyTo(nodeArray, 0);
}
int length = nodeArray.Length;
if (length != 0)
{
for (int i = 0; i < length; i++)
{
if (((ObjectSelectorEditor.SelectorNode) nodeArray[i]).value == value)
{
base.SelectedNode = nodeArray[i];
return true;
}
if ((nodeArray[i].Nodes != null) && (nodeArray[i].Nodes.Count != 0))
{
nodeArray[i].Expand();
if (this.SetSelection(value, nodeArray[i].Nodes))
{
return true;
}
nodeArray[i].Collapse();
}
}
}
return false;
}
示例3: SortNodes
/// <summary>Sorts the specified nodes.</summary>
/// <param name="nodes">The nodes.</param>
/// <param name="recursive">if set to <c>true</c> recursively sorts the children nodes.</param>
protected void SortNodes(TreeNodeCollection nodes, bool recursive)
{
TreeNode[] array = new TreeNode[nodes.Count];
nodes.CopyTo(array, 0);
Array.Sort(array, base.TreeViewNodeSorter);
nodes.Clear();
nodes.AddRange(array);
if (recursive)
{
foreach (TreeNode child in array) SortNodes(child.Nodes, true);
}
}
示例4: SortNodes
public void SortNodes(TreeNodeCollection nodes, bool recursive)
{
if (this.isSorted)
{
TreeNode[] dest = new TreeNode[nodes.Count];
nodes.CopyTo(dest, 0);
Array.Sort<TreeNode>(dest, this.nodeSorter);
nodes.Clear();
nodes.AddRange(dest);
if (recursive)
{
foreach (TreeNode node in dest)
{
this.SortNodes(node.Nodes, true);
}
}
}
}
示例5: RefreshNodes
/// <summary>Refreshes the specified nodes.</summary>
/// <param name="nodes">The nodes.</param>
private void RefreshNodes(TreeNodeCollection nodes)
{
TreeNode[] dest = new TreeNode[nodes.Count];
nodes.CopyTo(dest, 0);
nodes.Clear();
nodes.AddRange(dest);
}