Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to knw how to place the menus dynamically by using the menu strip.

 >I have a form with two split containers with Dock.<br />
>I want to add a menu strip in the second split container of panel1.<br />
>I set the menu strip dock to also but the menu strip docks above the split container at the run time.

How do I set the menu strip to dock at the correct place?

Here with the code :
this.menuStrip1 = new MenuStrip();
menuStrip1.Location = new System.Drawing.Point(40, 200);

ToolStripMenuItem menu1 = new ToolStripMenuItem("File");
ToolStripMenuItem menuItem1 = new ToolStripMenuItem("Send SMS", null, m_Click);

menuStrip1.Items.Add(menu1);
menu1.DropDownItems.Add(menuItem1);

Controls.Add(menuStrip1);

Cheers,
ParvathySunu
Posted
Updated 24-May-11 23:10pm
v2

1 solution

try this code
menuStrip1 control add to splitContainer1.Panel2

MenuStrip menuStrip1 = new MenuStrip();
            menuStrip1.Location = new System.Drawing.Point(40, 200);
            ToolStripMenuItem menu1 = new ToolStripMenuItem("File");
            ToolStripMenuItem menuItem1 = new ToolStripMenuItem("Send SMS", null);
            menuStrip1.Items.Add(menu1);
            menu1.DropDownItems.Add(menuItem1);
            this.splitContainer1.Panel2.Controls.Add(menuStrip1);
 
Share this answer
 
Comments
ParvathySunu 25-May-11 5:43am    
hi,
Its is working......ThankYou.

cheers,
ParvathySunu

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900