當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。