火车头的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);
                }

                
            }

        }


posted on 2006-10-18 00:02 _火车头_ 阅读(755) 评论(2) 编辑 收藏

Feedback

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

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

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

关注  回复 引用 查看   

导航

统计信息

News

搜索

 
 

常用链接

随笔分类

随笔档案

相册

学习类

友情连接

娱乐类

最新评论

阅读排行榜

评论排行榜

推荐排行榜