2个回答
展开全部
简单实现,自己扩展;首先拖个menuStrip控件至页面上,然后添加如下代码
ToolStripMenuItem toolStripMenuItem1 = new ToolStripMenuItem();
ToolStripMenuItem toolStripMenuItem2 = new ToolStripMenuItem();
ToolStripMenuItem toolStripMenuItem3 = new ToolStripMenuItem();
ToolStripMenuItem ToolStripMenuItem1 = new ToolStripMenuItem();
this.menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenuItem1 });
ToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] {
toolStripMenuItem1,
toolStripMenuItem2,
toolStripMenuItem3});
ToolStripMenuItem1.Text = "文件";
toolStripMenuItem1.Text = "创建";
toolStripMenuItem2.Text = "打开";
toolStripMenuItem3.Text = "保存";
更多追问追答
追问
this.menuStrip1.Items.AddRange(new ToolStripItem[] { ToolStripMenuItem1 });
ToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] {
什么意思??不是我想要的结果
追答
那你想要什么结果?这不就是动态创建菜单吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询