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. Xamarin for Visual Studio 3.11.658 Alpha 版 破解补丁

    注意:此版本为 Alpha 版,版本迭代较频繁,仅供尝鲜 前提概要 全新安装请参考 安装 Xamarin for Visual Studio. 最新稳定版请参考 Xamarin for Visual ...

  2. QTP之web常用对象

    web对象是我做自动化以来最早学习,最早接触的.对现在而言也是最熟悉不过的了,但是为了以后更稳健的前进,对基础的东西搞扎实,相信以后的路会顺畅许多,下边简单汇总下web的常用几类对象: Browser ...

  3. 安装SQL Server 2012遇到“需要更新的以前的Visual Studio 2010实例.”

    Microsoft Visual Studio 2010 Service Pack 1(exe) 下载链接:http://www.microsoft.com/zh-cn/download/confir ...

  4. java @param参数注解

    注解,@param是参数的解释.如/***@param s 这里表示对s的文字说明,描述 */ public void aa(String s){}一般java中@表示注解,解释一个方法,类,属性的作 ...

  5. Sina App Engine(SAE)入门教程(3)-KVDB使用

    简介 因为传统关系型数据库在分布式环境下表现的扩展性不足等缺点,近年来NoSQL的概念渐渐成为业界关注的焦点,越来越多的技术人员也习惯于使用NoSQL数据库进行日常开发,SAE为了应对这种新需求,也进 ...

  6. 网上图书商城项目学习笔记-011Book模块查询(分页)

    一.流程分析 1.图书模块 2.分布分析 二.代码 1.view层 1)list.jsp <%@ page language="java" import="java ...

  7. Hibernate 多表关联

    hibernate中可以一次对多个表进行数据插入,这种插入类似 Hibernate的关联映射关系有:多对一 ---- many-to-one一对多 ---- one-to-many一对一 ---- o ...

  8. 从unity3d官网下载教程

    http://unity3d.com/learn/tutorials/projects/tanks-tutorial 官网的教程提供的下载链接https://www.assetstore.unity3 ...

  9. Android Material Design-TabLayout的使用

    TabLayout 位于 android.support.design.widget.TabLayout. 一般与 ViewPager 结合在一起使用.以前有开源库 viewpagerindicato ...

  10. word引用错误

    错误 4317 无法嵌入互操作类型“Microsoft.Office.Interop.Word.ApplicationClass”.请改用适用的接口. 类型“Microsoft.Office.Inte ...