1 向工作区拖入一个DevExpress.XtraBas.Barmanager控件,拖入一个DevExpress.XtraBas.PopupMenu控件。

2 PopupMenu控件设定Manager属性是刚才拖入的Barmanager名称,在PopupMenu控件右击设定“Customise”,设定具体菜单

C# DEV 右键出现菜单

3 树右击菜单的代码

        /// <summary>
        /// 右击节点出现的菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeDistrictInfo_MouseUp(object sender, MouseEventArgs e)
        {
            TreeList tree = sender as TreeList;
            if ((e.Button == MouseButtons.Right) && (ModifierKeys == Keys.None)
                 && (treeDistrictInfo.State == TreeListState.Regular))
            {
                Point p = new Point(Cursor.Position.X, Cursor.Position.Y);
                TreeListHitInfo hitInfo = tree.CalcHitInfo(e.Location);
                if (hitInfo.HitInfoType == HitInfoType.Cell)
                {
                    tree.SetFocusedNode(hitInfo.Node);
                    popupMenu1.ShowPopup(p);
                }
            }
         } 

 

 

相关文章:

  • 2022-02-23
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2022-02-12
猜你喜欢
  • 2022-01-15
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-10-20
相关资源
相似解决方案