欢迎来到天天文库
浏览记录
ID:24235887
大小:91.54 KB
页数:4页
时间:2018-11-13
《reelist 复选框选中节点》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、查看文章 TreeList复选框选中节点2009-06-0417:32 1///treeLArea : TreeList;2///imglChecked: ImageList;3///4///56//指定StateImageList7this.treelArea.StateImageList=this.imglChecked;89//treelArea的GetStateImage事件处理程序10privatevoidtreelArea_GetStateImage(objectsender,DevExpress.XtraTreeList.GetStateImageEvent
2、Argse)11{12 try13 {14 CheckStatecheckState=(CheckState)e.Node.GetValue("checkState");15 e.NodeImageIndex=(checkState==CheckState.Unchecked)?0:(checkState==CheckState.Checked?1:2);16 }17 catch(Exception)18 {1920 }2122}2324//鼠标单击事件处理25privatevoidtreelArea_MouseDo
3、wn(objectsender,MouseEventArgse)26{27 if(e.Button==MouseButtons.Left)28 {29 TreeListHitInfohitInfo=(senderasTreeList).CalcHitInfo(newPoint(e.X,e.Y));30 if(hitInfo.HitInfoType==HitInfoType.StateImage)31 {32 SetCheckValue(hitInfo.Node);
4、 33 }34 }35}363738//设置节点状态39 privatevoidSetCheckValue(TreeListNodenode)40 {41 CheckStatecheckState=CheckState.Unchecked;42 if((CheckState)node.GetValue("checkState")==CheckState.Unchecked
5、
6、(CheckState)node.GetValue("checkState")==CheckState.Indeterminate)43
7、 {44 checkState=CheckState.Checked;45 }46 node.TreeList.FocusedNode=node;47 node.TreeList.BeginUpdate();48 node.SetValue("checkState",checkState);49 SetParentCheckState(node,checkState);50 SetchildCheckState(node,checkState);51
8、 node.TreeList.EndUpdate(); 52 }5354//递归设置父节点55 privatevoidSetParentCheckState(TreeListNodenode,CheckStatecheckState)56 {57 TreeListNodeparentNode=node.ParentNode;58 boolstyle=false;59 if(parentNode!=null)60 { 61 forea
9、ch(TreeListNode ninparentNode.Nodes)62 {63 if(!checkState.Equals((CheckState)n.GetValue("checkState")))64 {65 style=true;66 break;67
此文档下载收益归作者所有