当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.Remove方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:adesproject,项目名称:ADES,代码行数:31,代码来源:Form1.cs

示例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;
     }
 }
开发者ID:x893,项目名称:BTool,代码行数:27,代码来源:TreeViewUtils.cs

示例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;
                }
            }
        }
开发者ID:suniltaneja,项目名称:DocumentDBStudio,代码行数:27,代码来源:MainForm.cs

示例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);
 }
开发者ID:RunningStudent,项目名称:MyLearningCode_CSharp,代码行数:14,代码来源:Form1.cs

示例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);
        }
开发者ID:anhlehoang410,项目名称:SB3Utility,代码行数:11,代码来源:TriStateTreeView.cs

示例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;
     }
 }
开发者ID:fiftin,项目名称:oblqo,代码行数:12,代码来源:ControlUtil.cs

示例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..
     }
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:13,代码来源:MainForm.cs

示例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);
        }
开发者ID:Tapsmax,项目名称:ArtemisMissionEditor,代码行数:58,代码来源:TreeViewEx.cs

示例9: OnTreeNodeRemove

 private void OnTreeNodeRemove( TreeNode tnChild )
 {
     tnChild.Remove();
 }
开发者ID:ilya11211,项目名称:nprof,代码行数:4,代码来源:ProjectTree.cs

示例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;
        }
开发者ID:Kristd,项目名称:backup,代码行数:29,代码来源:MWTreeView.cs

示例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();
            }
        }
开发者ID:emps2222,项目名称:NBTExplorer,代码行数:15,代码来源:MainForm.cs

示例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;
                }
            }
        }
开发者ID:chauit,项目名称:ElectronicStore,代码行数:31,代码来源:MDI.cs

示例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();
     }
 }
开发者ID:r-bel,项目名称:glorg2,代码行数:8,代码来源:MainForm.cs

示例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();
        }
开发者ID:robincornelius,项目名称:radegast,代码行数:17,代码来源:InventoryConsole.cs

示例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;
     }
 }
开发者ID:VarocalCross,项目名称:Varocal,代码行数:34,代码来源:Form1.cs


注:本文中的System.Windows.Forms.TreeNode.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。