http://www.itjungles.com/how-to-easily-create-popup-menu-for-devexpress-treelist.html

Adding popup menu to DevExpress treelist is an easy task. Follow these simple steps to accomplish this:

1. Once you have the project setup and you have added the treelist to your Windows form. Go to the Toolbox and added in BarManager and Popup Menu. It is located under the section DX.9.3: Navigation & Layout.

2. Now below for your form designer there will be two items. Click on the ResultMenu property and assign the barManager1 to the Manager property.

       >>>>>>>   

3. Now you will need to add some code to the CloseUp event for the popup menu. Double click on the CloseUp event so that it will automatically generate the event handler in the code behind file.

private void ResultMenu_CloseUp(object sender, EventArgs e)

{

if (NeedRestoreFocused)

tlFuncLoc.FocusedNode = SavedFocused;

}

4. Now you need to write some code to the treelist MouseUp event.

On the treelist properties windows double click on the MouseUp event.

private void tlFuncLoc_MouseUp(object sender, MouseEventArgs e)

{

TreeList tree = sender as TreeList;

if (e.Button == MouseButtons.Right && ModifierKeys == Keys.None && tree.State == TreeListState.Regular)

{

Point pt = tree.PointToClient(MousePosition);

TreeListHitInfo info = tree.CalcHitInfo(pt);

if (info.HitInfoType == HitInfoType.Cell)

{

SavedFocused = tree.FocusedNode;

int SavedTopIndex = tree.TopVisibleNodeIndex;

tree.FocusedNode = info.Node;

NeedRestoreFocused = true;

ResultMenu.ShowPopup(MousePosition);

}

}

}

5. Add the two below variable to the top of the class.

TreeListNode SavedFocused;

bool NeedRestoreFocused;

6. Now click on Customize on the Popup menu to start adding the menu item. Double click on the menu item to create the event handler for that menu item.

Addtional examples:

http://www.devexpress.com/Support/Center/KB/p/A915.aspxhttp://www.devexpress.com/Help/?document=XtraBars/CustomDocument5472.htm&levelup=true

How to easily create popup menu for DevExpress treelist z的更多相关文章

  1. create Context Menu in Windows Forms application using C# z

    In this article let us see how to create Context Menu in Windows Forms application using C# Introduc ...

  2. Anaconda Error opening file for writing , failed to create anacoda menu等报错问题解决方案

    安装anaconda的时候可能会遇到这个报错, 原因可能是:路径不允许有空格 此外发生报错failed to create anacoda menu, 解决方案 进入 cmd,找到你安装的位置(我的是 ...

  3. windows安装anaconda 报错failed to create anacoda menu ?

    windows安装anaconda 报错failed to create anacoda menu ? 装了无数次,每次都是 failed to create anacoda menu然后无选择忽略, ...

  4. Android -- Options Menu,Context Menu,Popup Menu

    Options Menu                                                                           创建选项菜单的步骤: 1. ...

  5. popup menu案例,无说明只代码

    效果图: 布局文件, 展示列表的容器 <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...

  6. Devexpress TreeList控件绑定显示父子节点对像

    今天一位同事咨询Devexpress TreeList控件绑定自动显示父子节点对像,但结果是不会显示带父子节点关系,而是将所有的节点作为父节点显示出来了,对像类的代码如下 public class I ...

  7. 如何让DevExpress TreeList的每个结点高亮显示?

    概述:如何让DevExpress TreeList的每个节点高亮显示? 如何让DXperience TreeList的每个节点高亮显示? 效果如下: private void treeList1_Cu ...

  8. DevExpress TreeList使用教程之绑定多级树

    DevExpress TreeList使用教程之绑定多级树   概述:TreeList控件可以同时显示树结构和其他数据列,即在一个列上建立父子关系展开或收缩,同时还可以显示其他列的内容.在TreeLi ...

  9. Android学习总结——Popup menu:弹出式菜单

    PopupMenu,弹出菜单,一个模态形式展示的弹出风格的菜单,绑在在某个View上,一般出现在被绑定的View的下方(如果下方有空间). 注意:弹出菜单是在API 11和更高版本上才有效的. 核心步 ...

随机推荐

  1. hdu 4686 Arc of Dream

    思路:构造矩阵 a[i]*b[i]=ax*bx*a[i-1]*b[i-1]+ax*by*a[i-1]+ay*bx*b[i-1]+ay*by 代码如下: #include<iostream> ...

  2. struts2学习笔记(3)——struts2的局部类型转换

    今天又学到了一个新的东西,就是struts2的类型转换. 为什么要类型转换? 今天我就要传一个点的坐标给你,保存时用一个自定义的Point类来保存. 因为在表单里面传过去的是字符串,如“12,23”, ...

  3. java String 空指针异常

    如下代码中,第8行和第10行均会提示Exception in thread "main" java.lang.NullPointerException. 第12行的写法可行. im ...

  4. Project Euler 83:Path sum: four ways 路径和:4个方向

    Path sum: four ways NOTE: This problem is a significantly more challenging version of Problem 81. In ...

  5. 【Android多屏适配】动态改变Listview item高度

    在ListView的Adapter中去直接获取传入View的LayoutParams是会报空指针异常的,唯一的方法是在xml中嵌套布局一层LinearLayout <?xml version=& ...

  6. android rabbitMQ

    http://www.cnblogs.com/wufawei/archive/2012/03/31/2427823.html http://www.raywenderlich.com/5527/get ...

  7. ios中addtarget的用法

    1.addtarget 的.部分使用事件没有直接的操作方式,需要进行调用.就要用addTarget. - (void)setupCustomView { self.customView = [[CHV ...

  8. chrome控制台小技巧

    对于大多数开发人员来说,chrome控制台最常用的命令就是 console.log()了,然后还有一些其他类似的命令,如: console.info()   提示信息 console.error() ...

  9. STL源码中map和set中key值不能修改的实现

    前言 最近正好刚刚看完,<stl源码剖析>这本书的map和set的源码部分.但是看完之后又突然发现,之前怎么没有注意到map和set容器中key不能修改是怎么实现的.故,特此整理如下. s ...

  10. JasperReports+iReport在eclipse中的使用

    转载:http://blog.csdn.net/daming924/article/details/7402295 一.介绍1)它可以PDF,HTML,XML等多种形式产生报表或动态报表,在新版本还支 ...