Im trying to learn how to add a menustrip with code. I want that my toolstripmenuitems stay next to each other like this:
But i'm getting this:
This is my code:
private void Form1_Load(object sender, EventArgs e)
{
MenuStrip menu;
menu = new MenuStrip();
ToolStripMenuItem test;
test = new ToolStripMenuItem("&test");
test.DropDownItems.Add("aa", null, aa_click);
menu.Items.Add(test);
this.Controls.Add(menu);
MenuStrip menu2;
menu = new MenuStrip();
ToolStripMenuItem test2;
test2 = new ToolStripMenuItem("&test2");
test2.DropDownItems.Add("zz", null, zz_click);
menu.Items.Add(test2);
this.Controls.Add(menu);
}
Thanks for helping me!
Don’t create multiple menu strips, but only a single one where you keep adding your menu items to: