DevExpress實(shí)現(xiàn)TreeList按條件隱藏節(jié)點(diǎn)CheckBox的方法
更新時間:2014年08月06日 16:42:22 投稿:shichen2014
這篇文章主要介紹了DevExpress實(shí)現(xiàn)TreeList按條件隱藏節(jié)點(diǎn)CheckBox的方法,需要的朋友可以參考下
本文實(shí)例講述了DevExpress實(shí)現(xiàn)TreeList按條件隱藏節(jié)點(diǎn)CheckBox的方法,在項目開發(fā)中有一定的使用價值。具體的實(shí)現(xiàn)方法如下:
主要功能代碼如下:
/// <summary>
/// 隱藏CheckBox
/// 說明
/// 在CustomDrawNodeCheckBox事件中使用
/// eg:
/// TreeList _curTree = (TreeList)sender;
/// _curTree.HideCheckBox(n => n.GetNodeType() == NodeType.Area || n.GetNodeType() == NodeType.CabsGroupRoot, e);
/// </summary>
/// <param name="tree">TreeList</param>
/// <param name="conditionHanlder">委托</param>
/// <param name="e">CustomDrawNodeCheckBoxEventArgs</param>
public static void HideCheckBox(this TreeListNode tree, Predicate<TreeListNode> conditionHanlder, CustomDrawNodeCheckBoxEventArgs e)
{
if (conditionHanlder(e.Node))
{
e.Handled = true;
}
}
代碼使用方法如下:
void LHTree_CustomDrawNodeCheckBox(object sender, CustomDrawNodeCheckBoxEventArgs e)
{
TreeList _curTree = (TreeList)sender;
_curTree.HideCheckBox(n => n.GetNodeType() == NodeType.Area || n.GetNodeType() == NodeType.CabsGroupRoot, e);
}
代碼運(yùn)行效果如下:

您可能感興趣的文章:
- DevExpress TreeList 常見問題解決方法
- DevExpress之TreeList用法實(shí)例總結(jié)
- DevExpress設(shè)置TreeList圖片節(jié)點(diǎn)背景色的方法
- DevExpress實(shí)現(xiàn)TreeList向上遞歸獲取公共父節(jié)點(diǎn)的方法
- DevExpress實(shí)現(xiàn)TreeList父子節(jié)點(diǎn)CheckState狀態(tài)同步的方法
- DevExpress實(shí)現(xiàn)禁用TreeListNode CheckBox的方法
- Devexpress treelist 簡介
相關(guān)文章
簡單掌握Windows中C#啟動外部程序進(jìn)程的方法
這篇文章主要介紹了Windows中C#啟動外部程序進(jìn)程的方法,例子中同時包括了進(jìn)程關(guān)閉的方法,需要的朋友可以參考下2016-03-03
c#求點(diǎn)到直線的投影點(diǎn)坐標(biāo)
這篇文章主要介紹了c#求直線外一點(diǎn)到該直線的投影點(diǎn),大家參考使用吧2013-12-12
C#如何在窗體程序中操作數(shù)據(jù)庫數(shù)據(jù)
這篇文章主要介紹了C#如何在窗體程序中操作數(shù)據(jù)庫數(shù)據(jù),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-04-04
C#調(diào)用QQ_Mail發(fā)送郵件實(shí)例代碼兩例
這篇文章介紹了C#調(diào)用QQ_Mail發(fā)送郵件的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-04-04
C# winform打開Excel文檔的方法總結(jié)(必看篇)
下面小編就為大家?guī)硪黄狢# winform打開Excel文檔的方法總結(jié)(必看篇)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-01-01
C# 使用Microsoft Edge WebView2的相關(guān)總結(jié)
這篇文章主要介紹了C# 使用Microsoft Edge WebView2的相關(guān)總結(jié),幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下2021-02-02

