正常的添加根结点的效果如下:

但是勇哥使用时是这样的

其原因是没有指定显示内容的属性。
TreeViewAdv控件的显示内容包括: 选择框、文件夹图标、textbox控件
你得先指定这些要显示的对象的属性
演示代码:
using Aga.Controls.Tree;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        private Aga.Controls.Tree.NodeControls.NodeCheckBox _nodeCheckBox;
        private Aga.Controls.Tree.NodeControls.NodeStateIcon _nodeStateIcon;
        private Aga.Controls.Tree.NodeControls.NodeTextBox _nodeTextBox;
        private TreeModel _model;
        public Form1()
        {
            InitializeComponent();
            this._nodeCheckBox = new Aga.Controls.Tree.NodeControls.NodeCheckBox();
            this._nodeStateIcon = new Aga.Controls.Tree.NodeControls.NodeStateIcon();
            this._nodeTextBox = new Aga.Controls.Tree.NodeControls.NodeTextBox();
            this._nodeTextBox.DataPropertyName = "Text";
            this._nodeTextBox.EditEnabled = true;
            this._tree.NodeControls.Add(this._nodeCheckBox);
            this._tree.NodeControls.Add(this._nodeStateIcon);
            this._tree.NodeControls.Add(this._nodeTextBox);
            _model = new TreeModel();
            _tree.Model = _model;
            ChangeButtons();
        }
      
        private void button1_Click(object sender, EventArgs e)
        {
            Node node = new Node("root222222" + _model.Nodes.Count.ToString());
            _model.Nodes.Add(node);
            _tree.SelectedNode = _tree.FindNode(_model.GetPath(node));
        }
        private void Form1_Load(object sender, EventArgs e)
        {
         
        }
        private void ChangeButtons()
        {
            //_addChild.Enabled = _deleteNode.Enabled = (_tree.SelectedNode != null);
        }
    }
}现在有了。

---------------------
作者:hackpig
来源:www.skcircle.com
版权声明:本文为博主原创文章,转载请附上博文链接!
本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:



 少有人走的路
少有人走的路




















