火车头的Blog!

火车,沉稳、快速的前进

给TreeList的根和子节点弹出不同的右键菜单

好象没几个人用dev的treelist,好早就想实现这个效果,经过一个多小时的摸索,终于找到了实现方法

定义两个不同的popup contentMenu
在mouse_down事件中处理
private void JobTree_MouseDown(object sender, MouseEventArgs e)
        
{
            
if (e.Button == MouseButtons.Right)
            
{
                DevExpress.XtraTreeList.TreeListHitInfo hInfo 
= this.JobTree.CalcHitInfo(new Point(e.X, e.Y));
                
if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了
                {
                    
if(hInfo.Node.RootNode.Id==hInfo.Node.Id) //说明是根节点 站点
                        this.barManager1.SetPopupContextMenu(this.JobTree, this.popupSite);
                    
else  //任务
                        this.barManager1.SetPopupContextMenu(this.JobTree, this.popupJob);
                }

                
            }

        }


0
0
(请您对文章做出评价)
« 上一篇:ASCII码对照表[备忘]
» 下一篇:The Atalasoft OCR engine

posted on 2006-10-18 00:02 臨風 阅读(387) 评论(2)  编辑 收藏 所属分类: .net探索

Feedback

#1楼 2008-12-16 14:12 happy1tian      

正是我所需要的   回复  引用  查看    

#2楼 2009-03-06 14:04 子逸      

关注   回复  引用  查看    

导航

统计信息

News

搜索

 
 

常用链接

我参与的团队

随笔分类

随笔档案

相册

学习类

友情连接

娱乐类

最新评论

阅读排行榜

评论排行榜