Enable context menus

If I have a context menu, can I connect it to another menu? So you get:

  Menu 1 Item 1
  Menu 1 Item 2
  Menu 1 Item N
    ---------
  Menu 2 Item 1
  Menu 2 Item 2
  Menu 2 Item N

Take an example of a program like a notebook. There is a repetition in the menu that there is a standard set of tools that are displayed both in the editing menu and in the context menu of editing control (Cut, Copy, Paste, Select All ...).

I would like to have a menu under the name ClipboardToolsthat appears both in the editing menu and in the control context menu, without the need to create elements more than once. Of course, in this case, the repetition is not so bad, but I have to deal with larger menus that appear in 3-4 different menus, and ideally not as a submenu.

+5
1

. , :

  var joinedMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  menu1.Items.Add(joinedMenuItem );
  menu2.Items.Add(joinedMenuItem );

;

  menu1.Items.AddRange(menu2.Items);

, :
ToolStripMenu - .
ToolStripMenuItem DropDownItems.

, (, "" "" ), :

  foreach (var item in topMenuItem2.DropDownItems)
  {
      topMenuItem1.DropDownItems.Remove(item);
  }

, ​​ , . , , . .

. Visual Studio.

+5

All Articles