Elie
Elie

Reputation: 13855

Moving a menu in Visual C#

I have a menu with the following structure (simplified for illustration purposes):

Menu Bar
 |--File
 |   |--Save
 |   |--Exit
 |--Tools
 |   |--Tool Category 1
 |   |--Tool Category 2
 |   |--Tool Category 3
 |--Help
     |--About

I want to reconstruct this as follows:

Menu Bar
 |--File
 |   |--Save
 |   |--Exit
 |--Tool Category 1
 |--Tool Category 2
 |--Tool Category 3
 |--Help
     |--About

However, in Visual Studio 2008 Pro it won't let me drag these menu items other than reorganize them within the particular menu group they are already in. Is there a way for me to move them without completely rebuilding the menu bar? Note that there are actually many more menu items than those that I've shown.

Upvotes: 5

Views: 2638

Answers (3)

Ruben_Vuittonet
Ruben_Vuittonet

Reputation: 51

You can also go to the Designer Code for the Menu Items. You will find code similar to:

       this.mnuInfo.Items.AddRange(
          new System.Windows.Forms.ToolStripItem[] {
             this.mniAddNewProject,
             this.mniAddNewWorkFlow,      
             this.mniDeleteProject
          }
       );

Add the menu item into which you want to move your existing menu items and then modify then move the items.

       this.mnuInfo.Items.AddRange(
          new System.Windows.Forms.ToolStripItem[] {
             this.mniAddNewProject
          }
       );
       this.newMenuItem.Items.AddRange(
          new System.Windows.Forms.ToolStripItem[] {
             this.mniAddNewWorkFlow,      
             this.mniDeleteProject
          }
       );

And that's it. I hope this helps.

Upvotes: 5

Vojislav Stojkovic
Vojislav Stojkovic

Reputation: 8153

I tried this and it worked:

  1. Right click on the menu item you want to move
  2. Select "Cut" in the context menu
  3. Right click on the menu strip where you want to move it
  4. Select "Paste" in the context menu

Hope it helps.

Upvotes: 2

Kredns
Kredns

Reputation: 37211

Just redo the menu from scratch, sometimes it's best to just start over! :-)

Upvotes: 1

Related Questions