日期:2014-05-16 浏览次数:20990 次
fTreeContainer = new PopupContainerControl();
this.Properties.PopupControl = fTreeContainer;
//添加树
fTree = new TreeList();
fTreeContainer.Controls.Add(fTree);
fTree.Dock = DockStyle.Fill;
//设置树的属性
TreeHelper.SetTreeListCommonProperty(fTree); //设置树的公共属性
fTree.OptionsBehavior.Editable = false; //不允许编辑
fTree.OptionsMenu.EnableColumnMenu = false; //禁用列菜单
//设置主键列与父列
fTree.KeyFieldName = fDataField.TreeKeyFieldName;
fTree.ParentFieldName = fDataField.TreeParentFieldName;
tree.Font = ResourceService.DefaultFont;
tree.OptionsView.EnableAppearanceEvenRow = true;
tree.OptionsView.EnableAppearanceOddRow = true;
tree.OptionsBehavior.UseTabKey = true;
tree.Appearance.OddRow.BackColor = Color.White;
tree.Appearance.OddRow.Options.UseBackColor = true;
tree.Appearance.EvenRow.BackColor = Color.Linen;
tree.Appearance.EvenRow.Options.UseBackColor = true;
tree.OptionsView.AutoWidth = false;
tree.AfterExpand += new NodeEventHandler(tree_AfterExpand);
tree.CustomDrawNodeCell += new CustomDrawNodeCellEventHandler(TreeList_CustomDrawNodeCell);
tree.CustomDrawColumnHeader += new CustomDrawColumnHeaderEventHandler(tree_CustomDrawColumnHeader);
TreeListRowNumberHelper.Do(tree);