DevExpress 给TreeList添加右键菜单

只有在右击节点时才会触发

private void treeList1_MouseDown(object sender, MouseEventArgs e)
      {

          if (e.Button == MouseButtons.Right)
          {
              treeList1.ContextMenuStrip = null;

              TreeListHitInfo hInfo = treeList1.CalcHitInfo(new Point(e.X, e.Y));
              TreeListNode node = hInfo.Node;
              treeList1.FocusedNode = node;
              if (node != null)
              {
                  treeList1.ContextMenuStrip = contextMenuStrip1;
              }
          }
posted @ 2011-05-12 22:27  梦想(胡大利)  阅读(598)  评论(0编辑  收藏  举报