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. POJ 1734

    #include<iostream> #include<stdio.h> #define MAXN 105 #define inf 123456789 using namesp ...

  2. Class

    1. No const constructor Unlike other member functions, constructors may not be declared as const . W ...

  3. 在实体注解OneToMany时,要加上mappedby,避免产生中间表。

    在实体注解OneToMany时,要加上mappedby,避免产生中间表.

  4. Javascript的9张思维导图学习

    思维导图小tips:思维导图又叫心智图,是表达发射性思维的有效的图形思维工具 ,它简单却又极其有效,是一种革命性的思维工具.思维导图运用图文并重的技巧,把各级主题的关系用相互隶属与相关的层级图表现出来 ...

  5. 学习笔记--Grunt、安装、图文详解

    学习笔记--Git安装.图文详解 安装Git成功后,现在安装Gruntjs,官网:http://gruntjs.com/ 一.安装node 参考node.js 安装.图文详解 (最新的node会自动安 ...

  6. Android service的开启和绑定,以及调用service的方法

    界面: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= ...

  7. 使用getJSON()方法异步加载JSON格式数据

    使用getJSON()方法异步加载JSON格式数据 使用getJSON()方法可以通过Ajax异步请求的方式,获取服务器中的数组,并对获取的数据进行解析,显示在页面中,它的调用格式为: jQuery. ...

  8. 初识Redis

    package com.wangzhu.redis; import java.util.List; import org.junit.After; import org.junit.Before; i ...

  9. 246. Strobogrammatic Number

    题目: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at ups ...

  10. 37. Sudoku Solver

    题目: Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated b ...