[c# winform] devexpress treeList right-click menu adds button

[c# winform] devexpress treeList right-click menu adds button
[c# winform] devexpress treeList right-click menu adds button This article provides two methods that do not require manual addition of edit controls. Method 1: Create a new right-click menu and add the “Execute Selection” button, and suppress the TreeList’s own menuResult display: Code: private void Form1_Load(object sender, EventArgs e ) { CreateBarButtonItem(); } private void span> CreateBarButtonItem() { // Create a right button Menu ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); // Add” Execute Select menu item ToolStripMenuItem execSelectedItem = new ToolStripMenuItem(“Execute selection”); execSelectedItem.Click += ExecSelectedItem_Click; ; contextMenuStrip.Items.Add(execSelectedItem); // Associated right-click Menu and TreeList control treeList1.PopupMenuShowing += TreeList1_PopupMenuShowing; } private void span> TreeList1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { // Disable auto With right-click menu e.Allow = false; } private void span> ExecSelectedItem_Click(object sender, EventArgs e) { //Process ” Execute selection” event logic } Method 2: Add the “Execute Selection” button to the TreeList’s own menu Result display: Right-click on an empty node Right-click the node and retain the built-in menu function Right-click the column title and retain the built-in menu function Code: private void Form1_Load(object sender, EventArgs e ) { treeList1.PopupMenuShowing += TreeList1_PopupMenuShowing;//Customized right-click display menu } private void span> TreeList1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) { // Get the right button Menu if (e.Menu…