我想知道如何通过使用菜单栏动态放置菜单. [英] I want to knw how to place the menus dynamically by using the menu strip.
本文介绍了我想知道如何通过使用菜单栏动态放置菜单.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使用菜单栏动态放置菜单.
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);
干杯,
ParvathySunu
Cheers,
ParvathySunu
推荐答案
尝试此代码
menuStrip1控件添加到splitContainer1.Panel2
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);
这篇关于我想知道如何通过使用菜单栏动态放置菜单.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文