--- title: "How to: Attach a Shortcut Menu to a TreeNode Using the Designer" ms.date: "03/30/2017" helpviewer_keywords: - "shortcut menus [Windows Forms], attaching to TreeNodes" - "TreeNode [Windows Forms], attaching a shortcut menu using Designer" ms.assetid: 8e45e184-1313-4f8f-90ff-2cd5789b2268 --- # How to: Attach a Shortcut Menu to a TreeNode Using the Designer The Windows Forms control displays a hierarchy of nodes, similar to the files and folders displayed in the left pane of the Windows Explorer feature in Windows operating systems. By setting the property, you can provide context-sensitive operations to the user when they right-click the control. By associating a component with individual items, you can add a customized level of shortcut menu functionality to your controls. ## To associate a shortcut menu with a TreeNode at design time 1. Add a control to your form, and then add nodes to the as needed. For more information, see [How to: Add and Remove Nodes with the Windows Forms TreeView Control](how-to-add-and-remove-nodes-with-the-windows-forms-treeview-control.md). 2. Add a component to your form, and then add menu items to the shortcut menu that represent node-level operations you wish to make available at run time. For more information, see [How to: Add Menu Items to a ContextMenuStrip](how-to-add-menu-items-to-a-contextmenustrip.md). 3. Reopen the **TreeNodeEditor** dialog box for the control, select the node to edit, and set its property to the shortcut menu that you added. 4. When this property is set, the shortcut menu will be displayed when you right-click the node. Additionally, you will want to write code to handle the events for these menu items. ## See also - [TreeView Control](treeview-control-windows-forms.md) - [TreeView Control Overview](treeview-control-overview-windows-forms.md) - [ContextMenuStrip Control](contextmenustrip-control.md)