本文整理汇总了C#中System.Windows.Forms.TreeNode.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Remove方法的具体用法?C# TreeNode.Remove怎么用?C# TreeNode.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNode
private void AddNode(XmlNode inXmlNode, TreeNode inTreeNode)
{
XmlNode xNode;
TreeNode tNode;
XmlNodeList nodeList;
int i;
// Loop through the XML nodes until the leaf is reached.
// Add the nodes to the TreeView during the looping process.
if (inXmlNode.HasChildNodes && inXmlNode.FirstChild.HasChildNodes)
{
nodeList = inXmlNode.ChildNodes;
for (i = 0; i <= nodeList.Count - 1; i++)
{
xNode = inXmlNode.ChildNodes[i];
inTreeNode.Nodes.Add(xNode.Name, xNode.Name);
tNode = inTreeNode.Nodes[i];
AddNode(xNode, tNode);
}
}
else
{
// Here you need to pull the data from the XmlNode based on the
// type of node, whether attribute values are required, and so forth.
String str = (inXmlNode.InnerText).Trim();
TreeNode parent = inTreeNode.Parent;
inTreeNode.Remove();
parent.Nodes.Add(str, str);
//inTreeNode.Text = (inXmlNode.InnerText).Trim();
}
}
示例2: RecursiveTextSearchAndDestroy
private bool RecursiveTextSearchAndDestroy(TreeNode treeNode, string target)
{
bool flag1 = false;
if (treeNode.Text == target)
{
bool flag2 = true;
m_recursiveDestroy = true;
return flag2;
}
else
{
foreach (TreeNode treeNode1 in treeNode.Nodes)
{
if (treeNode1 != null)
{
flag1 = RecursiveTextSearchAndDestroy(treeNode1, target);
if (flag1 && m_recursiveDestroy)
{
treeNode.Remove();
m_recursiveDestroy = false;
break;
}
}
}
return flag1;
}
}
示例3: ChangeAccountSettings
public void ChangeAccountSettings(TreeNode thisNode, string accountEndpoint)
{
this.treeView1.SelectedNode = thisNode;
for (int i = 0; i < Settings.Default.AccountSettingsList.Count; i = i + 2)
{
if (string.Compare(accountEndpoint, Properties.Settings.Default.AccountSettingsList[i], StringComparison.OrdinalIgnoreCase) == 0)
{
AccountSettings accountSettings = (AccountSettings)JsonConvert.DeserializeObject(Settings.Default.AccountSettingsList[i + 1], typeof(AccountSettings));
// Bring up account setings dialog
SettingsForm dlg = new SettingsForm();
dlg.AccountEndpoint = accountEndpoint;
dlg.AccountSettings = accountSettings;
DialogResult dr = dlg.ShowDialog(this);
if (dr == DialogResult.OK)
{
thisNode.Remove();
RemoveAccountFromSettings(dlg.AccountEndpoint);
AddAccountToSettings(dlg.AccountEndpoint, dlg.AccountSettings);
}
break;
}
}
}
示例4: DeleteTreeNodeAndDataInDB
/// <summary>
/// 递归删除节点
/// </summary>
/// <param name="treeNode"></param>
private void DeleteTreeNodeAndDataInDB(TreeNode treeNode)
{
string sql = "delete TblArea where AreaId=";
while (treeNode.Nodes.Count != 0)
{
DeleteTreeNodeAndDataInDB(treeNode.Nodes[0]);
}
treeNode.Remove();
SqlHelper.ExecuteNonQuery(sql + treeNode.Tag.ToString(), CommandType.Text);
}
示例5: RemoveChild
public void RemoveChild(TreeNode node)
{
if (node.TreeView != this)
{
throw new Exception("The node doesn't belong to this TreeView");
}
TreeNode parent = node.Parent;
node.Remove();
UpdateParent(parent);
}
示例6: UpdateTeeViewNode
public static void UpdateTeeViewNode(AccountFileStates newFileState, TreeNode node)
{
if ((newFileState & AccountFileStates.Deleted) != 0)
{
node.Remove();
return;
}
if ((newFileState & AccountFileStates.New) != 0)
{
node.ForeColor = Color.Green;
}
}
示例7: PasteAction
private void PasteAction(TreeNode source, TreeNode dest)
{
if (dest != source && (!IsChildNode(source, dest) || dest == null))
{
var gc = (GroupComposite) ((Composite) source.Tag).Parent;
if ((_copyAction & CopyPasteOperactions.Copy) != CopyPasteOperactions.Copy)
gc.Children.Remove((Composite) source.Tag);
AddToActionTree(source, dest);
if ((_copyAction & CopyPasteOperactions.Copy) != CopyPasteOperactions.Copy) // ctrl key
source.Remove();
_copySource = null; // free any ref..
}
}
示例8: MoveNode
public void MoveNode(TreeNode what, TreeNode where, NodeRelationship relation, NodeRelationship subRelation = NodeRelationship.Null, bool suspendUpdate = false)
{
if (!IsAllowedToHaveRelation(where,what,relation))
return;
if (subRelation == NodeRelationship.Null)
subRelation = Settings.Current.DragIntoFolderToLastPosition ? NodeRelationship.ChildGoesUnder : NodeRelationship.ChildGoesAbove;
TreeNode result = null;
if (!suspendUpdate)
BeginUpdate();
if (where == null)
{
what.Remove();
Nodes.Add(what);
}
else
{
if (what != where)
switch (relation)
{
case NodeRelationship.ChildGoesAbove:
what.Remove();
if (where.Parent != null)
where.Parent.Nodes.Insert(where.Index, what);
else
Nodes.Insert(where.Index, what);
result = what;
break;
case NodeRelationship.ChildGoesInside:
what.Remove();
if (subRelation == NodeRelationship.ChildGoesUnder)
where.Nodes.Add(what);
if (subRelation == NodeRelationship.ChildGoesAbove)
where.Nodes.Insert(0, what);
result = what;
break;
case NodeRelationship.ChildGoesUnder:
what.Remove();
if (where.Parent != null)
where.Parent.Nodes.Insert(where.Index + 1, what);
else
Nodes.Insert(where.Index + 1, what);
result = what;
break;
}
}
if (result!=null)
SelectedNode = result;
if (!suspendUpdate)
EndUpdate();
OnNodeMoved(result, suspendUpdate);
}
示例9: OnTreeNodeRemove
private void OnTreeNodeRemove( TreeNode tnChild )
{
tnChild.Remove();
}
示例10: RemoveNode
/// <summary>
/// Remove one TreeNode. The TreeNode is also removed from the SelNodes property, the CheckedNodes property and/or the SelNode property.
/// </summary>
/// <param name="tn">TreeNode to remove.</param>
/// <returns>True if the TreeNode was removed or false otherwise.</returns>
public bool RemoveNode(TreeNode tn)
{
bool bRetVal = false;
if(tn != null)
{
DeleteNode(tn);
try
{
tn.Remove();
if(tn.TreeView == null && !IsTreeNodeSelected(tn) && !IsTreeNodeChecked(tn) && tn != this.SelNode)
{
bRetVal = true;
}
}
catch
{
}
}
return bRetVal;
}
示例11: DeleteNode
private void DeleteNode(TreeNode node)
{
if (node == null || !(node.Tag is DataNode))
return;
DataNode dataNode = node.Tag as DataNode;
if (!dataNode.CanDeleteNode)
return;
if (dataNode.DeleteNode()) {
UpdateUI(node.Parent.Tag as DataNode);
UpdateNodeText(node.Parent);
node.Remove();
}
}
示例12: UpdateTreeView
private void UpdateTreeView(TreeNode node, string functions)
{
if(node.Parent == null)
{
if(node.NextNode != null)
{
UpdateTreeView(node.NextNode, functions);
}
UpdateTreeView(node.FirstNode, functions);
if(node.Nodes.Count == 0)
{
node.Remove();
}
}
else
{
if(node.NextNode != null)
{
UpdateTreeView(node.NextNode, functions);
}
if (functions.IndexOf(node.Text) == -1)
{
node.Remove();
}
else
{
return;
}
}
}
示例13: RemoveNode
public void RemoveNode(TreeNode node)
{
if (node != null && node.Parent != null)
{
(node.Tag as Node).Parent.Remove(node.Tag as Node);
node.Remove();
}
}
示例14: removeNode
void removeNode(TreeNode node)
{
InventoryBase item = (InventoryBase)node.Tag;
if (item != null)
{
foreach (TreeNode child in node.Nodes)
{
removeNode(child);
}
lock (UUID2NodeCache)
{
UUID2NodeCache.Remove(item.UUID);
}
}
node.Remove();
}
示例15: MoveNode
void MoveNode( TreeNode position, TreeNode source )
{
if ( ParentContainer( source, position ) || position == source )
return;
if ( position.Tag is string && !Directory.Exists( position.Tag as string ) ) {
if ( source.Tag is string ) {
string newtag = ToRightPath( GetNodePath( position.Parent ) + source.Text );
File.Move( source.Tag as string, newtag );
source.Tag = newtag;
source.Remove( );
position.Parent.Nodes.Insert( 0, source );
} else {
ChangeTags( source, GetNodePath( source ), ToRightPath( GetNodePath( position.Parent ) + source.Text ) );
Directory.Move( GetNodePath( source ), ToRightPath( GetNodePath( position.Parent ) + source.Text ) );
source.Remove( );
position.Parent.Nodes.Insert( 0, source );
}
return;
} else {
if ( source.Tag is string ) {
string newtag = ToRightPath( GetNodePath( position ) + source.Text );
File.Move( source.Tag as string, newtag );
source.Tag = newtag;
source.Remove( );
position.Nodes.Insert( 0, source );
} else {
ChangeTags( source, GetNodePath( source ), ToRightPath( GetNodePath( position ) + source.Text ) );
Directory.Move( GetNodePath( source ), ToRightPath( GetNodePath( position ) + source.Text ) );
source.Remove( );
position.Nodes.Insert( 0, source );
}
return;
}
}