TreeViewAdv控件为啥添加根节点看不到内容


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

image.png

但是勇哥使用时是这样的

image.png


其原因是没有指定显示内容的属性。

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);
        }



    }
}


现在有了。

image.png


--------------------- 

作者:hackpig

来源:www.skcircle.com

版权声明:本文为博主原创文章,转载请附上博文链接!



本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2024年5月    »
12345
6789101112
13141516171819
20212223242526
2728293031
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864