DevExpress XtraTreeList的复选框 禁用

树的2个事件代码如下,通过节点的tag判断是否禁用节点前的复选框.树的节点加载时设置要禁用的节点tag为-1,不禁用的则设为相关的值

private void treeListPer_CustomDrawNodeCheckBox(object sender, DevExpress.XtraTreeList.CustomDrawNodeCheckBoxEventArgs e)
        {
            //TreeListNode listNode = sender as TreeListNode;
            if (e.Node.Tag.ToString()=="-1")
            {
                e.ObjectArgs.State = DevExpress.Utils.Drawing.ObjectState.Disabled;
            }
        }


        private void treeListPer_BeforeCheckNode(object sender, DevExpress.XtraTreeList.CheckNodeEventArgs e)
        {
            if (e.Node.Tag.ToString() == "-1")
            {
                e.State = CheckState.Unchecked;
            }
        }

 

你可能感兴趣的:(DevExpress)