Beispiel #1
0
        private void bindProjectData()
        {
            Document doc  = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            var      tree = Project.Instance.GetProjectTree(doc);

            treeList1.DataSource = tree;

            //把非Name的列隐藏
            if (treeList1.Columns.Count > 0)
            {
                for (int i = 0; i < treeList1.Columns.Count; i++)
                {
                    if (treeList1.Columns[i].FieldName != "Name")
                    {
                        treeList1.Columns[i].Visible = false;
                    }
                }
            }

            treeList1.ExpandToLevel(0);
            treeList1.ExpandToLevel(1);
            treeList1.ExpandToLevel(2);
        }