コード例 #1
0
 /// <summary>
 /// 删除焦点行。
 /// </summary>
 /// <param name="bindingSource"></param>
 public void RemoveFocusedRow(MB.WinBase.Binding.BindingSourceEx bindingSource)
 {
     if (_DataViewType == DataViewType.GridView)
     {
         bindingSource.RemoveCurrent();
     }
     else
     {
         _TreeList.DeleteNode(_TreeList.FocusedNode);
     }
 }
コード例 #2
0
ファイル: TreeManager.cs プロジェクト: presscad/DrawTunnel
        //点击右键菜单“删除”触发
        private void t1Delete_ItemClick(object sender, EventArgs e)
        {
            Document doc       = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            var      focusNode = treeList1.FocusedNode;

            List <ProjectTreeNode> tree = treeList1.DataSource as List <ProjectTreeNode>;
            var node = getProjectNode(focusNode);

            if (node == null)
            {
                treeList1.Nodes.Remove(focusNode);
                return;
            }

            if (containNode(node, Project.Instance.getCurrentSurface(doc)))
            {
                Autodesk.AutoCAD.ApplicationServices.Application.
                ShowAlertDialog("删除的节点不能包含当前工作面节点");
                return;
            }

            var pNode = node.GetParentNode();

            if (pNode != null)
            {
                pNode.Children.Remove(node);
            }

            List <ProjectTreeLeafNode> ls = new List <ProjectTreeLeafNode>();

            getLeafNodes(node, ls);//得到所有的叶子节点
            treeList1.DeleteNode(focusNode);
            DBEntityControl dbControl = Project.Instance.GetTmpEntCol(doc);

            foreach (var leafNode in ls)
            {
                long handleValue = leafNode.HandleValue;
                dbControl.Delete(Query.EQ("HandleValue", handleValue), this);
            }
            doc.Editor.Regen();
        }