本文整理汇总了C#中System.Windows.Forms.TreeNodeCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Remove方法的具体用法?C# TreeNodeCollection.Remove怎么用?C# TreeNodeCollection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.Remove方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveCheckedNodes
static void RemoveCheckedNodes(TreeNodeCollection nodes)
{
List<TreeNode> checkedNodes = new List<TreeNode>();
foreach (TreeNode node in nodes)
{
if (node.Tag == null && node.FirstNode == null)
{
checkedNodes.Add(node);
}
else
{
RemoveCheckedNodes(node.Nodes);
}
}
foreach (TreeNode checkedNode in checkedNodes)
{
nodes.Remove(checkedNode);
}
}
示例2: verifyReflexivesRecursive
private TreeNodeCollection verifyReflexivesRecursive(BinaryReader br, TreeNodeCollection tnc, int baseOffset)
{
for (int i = 0; i < tnc.Count; i++)
{
TreeNode tn = tnc[i];
string[] offsets = tn.Name.Split('\\');
if (tn.Nodes.Count > 0)
{
br.BaseStream.Position = baseOffset + int.Parse(offsets[offsets.Length - 1]);
int count = br.ReadInt32();
int offset = br.ReadInt32() - meta.magic - meta.offset;
if (count == 0)
{
tnc.Remove(tn);
i--;
continue;
}
else
{
tagInfo ti = (tagInfo)tn.Tag;
ti.chunkCount = count;
ti.offset = offset;
tn.Text += " [" + (ti.chunkSelection + 1).ToString() + "/" + ti.chunkCount.ToString() + "]";
TreeNodeCollection tnt = verifyReflexivesRecursive(br, tn.Nodes, offset);
TreeNode[] tna = new TreeNode[tnt.Count];
tnt.CopyTo(tna, 0);
tn.Nodes.Clear();
tn.Nodes.AddRange(tna);
}
}
}
return tnc;
}
示例3: SwapTreeNodes
private void SwapTreeNodes(TreeNodeCollection collection, int a, int b)
{
var aNode = collection[a];
var bNode = collection[b];
collection.Remove(aNode);
collection.Remove(bNode);
collection.Insert(a, bNode);
collection.Insert(b, aNode);
}
示例4: RemoveFromTree
/// <summary>
/// Remove shape from the tree node collection
/// </summary>
/// <param name="shape"></param>
/// <param name="treeNodes"></param>
/// <returns>true if removed</returns>
private static bool RemoveFromTree(DrawingShape shape, TreeNodeCollection treeNodes)
{
foreach (TreeNode node in treeNodes)
{
if (node.Tag == shape)
{
treeNodes.Remove(node);
return true;
}
if (node.Nodes.Count > 0 && RemoveFromTree(shape, node.Nodes))
return true;
}
return false;
}
示例5: MoveNode
private void MoveNode(int index, TreeNodeCollection nodes, TreeNode targetNode)
{
nodes.Remove(targetNode);
nodes.Insert(index, targetNode);
OnMovedNode(targetNode);
}
示例6: RemoveOld
private void RemoveOld(TreeNodeCollection aNodes, HashSet<LogEntry> aEntries)
{
List<TreeNode> deleteList = new List<TreeNode>();
foreach (TreeNode node in aNodes)
{
LogEntry entry = node.Tag as LogEntry;
if (entry != null && !aEntries.Contains(entry))
{
deleteList.Add(node);
}
else if (entry == null)
{
RemoveOld(node.Nodes, aEntries);
if (node.Nodes.Count == 0)
{
deleteList.Add(node);
}
}
}
foreach (TreeNode node in deleteList)
{
aNodes.Remove(node);
}
}
示例7: RemoveItem
private void RemoveItem(TreeNodeCollection lst, BaseObject obj)
{
LoadTreeNodeChilds();
if (obj is DataBase.Category)
{
DataBase.Category c = (DataBase.Category) obj;
for (int i = 0; i < lst.Count; i++)
{
if (lst[i] is TreeNodeCategory)
{
TreeNodeCategory cc = (TreeNodeCategory) lst[i];
if (cc.cat == c)
{
lst.RemoveAt(i);
return;
}
}
}
}
else if (obj is DataBase.Box)
{
DataBase.Box b = (DataBase.Box) obj;
for (int i = 0; i < lst.Count; i++)
{
if (lst[i] is TreeNodeBox)
{
TreeNodeBox bb = (TreeNodeBox) lst[i];
if (bb.InternalBox == b)
{
lst.Remove(bb);
return;
}
}
}
}
}
示例8: BindNode
private void BindNode(ISimulatorNode simNode, TreeNode node, TreeNodeCollection parent)
{
node.Text = simNode.DisplayName;
node.Tag = simNode;
var menu = new ContextMenu();
foreach (var nodeAction in simNode.Actions)
{
var action = new MenuItem(nodeAction.DisplayName);
action.Click += new EventHandler(
delegate(Object o, EventArgs a)
{
nodeAction.Invoke();
}
);
menu.MenuItems.Add(action);
}
if (simNode.Actions.Any())
{
menu.MenuItems.Add("-");
}
foreach (var factory in simNode.Children)
{
var action = new MenuItem(factory.DisplayName);
action.Click += new EventHandler(
delegate(Object o, EventArgs a)
{
var callbacks = new TreeNodeCallbacks(this);
var child = factory.Create(callbacks);
if (child != null)
{
this.BindNode(child, callbacks.node, node.Nodes);
}
}
);
menu.MenuItems.Add(action);
}
if (simNode.Children.Any())
{
menu.MenuItems.Add("-");
}
var item = new MenuItem("Remove");
item.Click += new EventHandler(
delegate(Object o, EventArgs a)
{
ShutdownFrom(node);
parent.Remove(node);
}
);
menu.MenuItems.Add(item);
node.ContextMenu = menu;
parent.Add(node);
}
示例9: RemoveNoneExistingNodes
/// <summary>
/// Removes all nodes that don't belong to anything anymore from a tree view.
/// </summary>
/// <param name="nodes">Collection of nodes to look through.</param>
/// <returns>True if any nodes were removed.</returns>
private bool RemoveNoneExistingNodes(TreeNodeCollection nodes)
{
foreach (TreeNode subnode in nodes)
{
if (RemoveNoneExistingNodes(subnode.Nodes) == true)
{
return true;
}
if (subnode.Tag != null &&
m_simulator.ArbitratorStates.Contains(subnode.Tag) == false &&
m_simulator.ClientStates.Contains(subnode.Tag) == false)
{
nodes.Remove(subnode);
return true;
}
}
return false;
}
示例10: RemoveByKey
private void RemoveByKey(TreeNodeCollection nodes, string key)
{
if (TestList.InvokeRequired == true)
{
this.Invoke(new RemoveNodeByKeyCB(RemoveByKey), new object[] { nodes, key });
return;
}
TreeNode node = FindByKey( nodes, key );
if( node != null )
nodes.Remove( node );
}
示例11: Remove
private void Remove(TreeNodeCollection nodes, TreeNode node)
{
if (TestList.InvokeRequired == true)
{
this.Invoke(new RemoveNodeCB(Remove), new object[] { nodes, node });
return;
}
nodes.Remove(node);
}