示例#1
0
 private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
 {
     try
     {
         tv.BeforeExpand -= tv_BeforeExpand;
         tv.BeginUpdate();
         Cursor.Current = Cursors.WaitCursor;
         var nodeData = e.Node.Tag as TreeNodeData;
         e.Node.Nodes.Clear();
         foreach (IHL73Object childObject in nodeData.Data.ChildObjects)
         {
             var childNodeData = new TreeNodeData(childObject);
             var childNode     = new TreeNode()
             {
                 Text = childNodeData.ToString(), Tag = childNodeData
             };
             e.Node.Nodes.Add(childNode);
             childNode.Nodes.Add("");
         }
     }
     finally
     {
         tv.EndUpdate();
         Cursor.Current   = Cursors.Default;
         tv.BeforeExpand += tv_BeforeExpand;
     }
 }
示例#2
0
        public void UpdateTree()
        {
            var      data = new TreeNodeData(controller.Document);
            TreeNode root = new TreeNode()
            {
                Text = data.ToString(), Tag = data
            };

            tv.Nodes.Add(root);
            root.Nodes.Add("");
        }