如何将菜单项添加到 devexpress 树列表上的默认右键单击

发布于 2024-10-05 18:23:01 字数 109 浏览 0 评论 0原文

我有一个 DevExpress(版本 9.2)TreeList,默认情况下显示一个菜单,其中包含升序/降序排序、列选择器和右键单击树标题时最适合的菜单。

我如何向这个默认菜单添加更多选择?

I have a DevExpress (version 9.2) TreeList that by default displays a menu containing sort ascending/descending, column chooser, and best fit when you right-click on the header of the tree.

How would I add more choices to this default menu?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三人与歌 2024-10-12 18:23:02

要添加到默认菜单,您需要使用 ShowTreeListMenu 操作侦听器并在其中添加行。

  Private Sub treeCompany_ShowTreeListMenu(ByVal sender As System.Object, ByVal e As DevExpress.XtraTreeList.TreeListMenuEventArgs) Handles treeCompany.ShowTreeListMenu
       ' add the ability to expand the nodes in the tree
        e.Menu.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("Expand All Nodes", AddressOf ExpandNode))
       ' make the last item added begin the group so you have a divider
        e.Menu.Items(e.Menu.Items.Count - 1).BeginGroup = True
       ' add the ability to collapse the nodes in the tree
        e.Menu.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("Collapse All Nodes", AddressOf CollapseAll))
  End Sub

第一个添加调用函数 ExpandNode(),第二个调用 CollapseAll()

To add to the default menu you need to use the ShowTreeListMenu action listener and add the rows in there.

  Private Sub treeCompany_ShowTreeListMenu(ByVal sender As System.Object, ByVal e As DevExpress.XtraTreeList.TreeListMenuEventArgs) Handles treeCompany.ShowTreeListMenu
       ' add the ability to expand the nodes in the tree
        e.Menu.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("Expand All Nodes", AddressOf ExpandNode))
       ' make the last item added begin the group so you have a divider
        e.Menu.Items(e.Menu.Items.Count - 1).BeginGroup = True
       ' add the ability to collapse the nodes in the tree
        e.Menu.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("Collapse All Nodes", AddressOf CollapseAll))
  End Sub

The first addition calls the function ExpandNode() and the second calls CollapseAll().

格子衫的從容 2024-10-12 18:23:01
    void treeList1_PopupMenuShowing(object sender, DevExpress.XtraTreeList.PopupMenuShowingEventArgs e)
    {
        DXMenuItem item = new DXMenuItem("New menu item");
        e.Menu.Items.Add(item);


    }

或者将菜单项添加到表单加载事件处理程序中。根据需要添加菜单单击处理程序。

    void treeList1_PopupMenuShowing(object sender, DevExpress.XtraTreeList.PopupMenuShowingEventArgs e)
    {
        DXMenuItem item = new DXMenuItem("New menu item");
        e.Menu.Items.Add(item);


    }

Or do the menu item add in the form load event handler. Add a menu click handler as needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文