Beispiel #1
0
        public TreeListNode CreateDbCodeTreeHead(DevExpress.XtraTreeList.TreeList treeList)
        {
            if (treeList.Nodes.Count > 0)
            {
                return(treeList.Nodes.FirstNode.RootNode);
            }


            treeList.Appearance.Row.Font              = new System.Drawing.Font("宋体", 15f, System.Drawing.FontStyle.Bold);
            treeList.Appearance.Row.ForeColor         = System.Drawing.Color.Blue;
            treeList.Appearance.SelectedRow.Font      = new System.Drawing.Font("宋体", 15f);
            treeList.Appearance.SelectedRow.ForeColor = System.Drawing.Color.Blue;
            treeList.Appearance.HeaderPanel.ForeColor = System.Drawing.Color.Blue;
            treeList.Appearance.FocusedCell.ForeColor = System.Drawing.Color.Red;

            DevExpress.XtraTreeList.Columns.TreeListColumn colo = treeList.Columns.Add();
            colo.Caption = "DB服务器";
            colo.Visible = true;
            treeList.OptionsView.ShowColumns   = false;          //隐藏列头
            treeList.OptionsView.ShowVertLines = false;          //去掉列边框线
            treeList.OptionsView.ShowIndicator = false;          //是否隐藏行号列

            treeList.OptionsView.AutoWidth = true;               //设置是否自动调节列宽

            treeList.Columns[0].OptionsColumn.AllowEdit = false; //设置是否编辑

            treeList.EndSort();                                  //禁止排序
            treeList.OptionsBehavior.Editable = false;           //禁止编辑

            TreeListNode _node = treeList.Nodes.Add("DB服务器", 0);

            //为添加下文的Node做准备
            DbLoginFor _DbLoginFor = new DbLoginFor();

            _DbLoginFor.LoginDb_Id    = "0";
            _DbLoginFor.LoginDb_Descp = "DB服务器";
            _node.Tag              = _DbLoginFor;
            _node.ImageIndex       = 0;
            _node.SelectImageIndex = 0;
            _node.ExpandAll();

            return(_node);
        }