Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 760
Elie Avatar asked Mar 02 '23 01:03

Elie


1 Answers

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.

like image 177
Ruben_Vuittonet Avatar answered Mar 07 '23 06:03

Ruben_Vuittonet