ContextMenuStrip 添加二级菜单,为什么二级菜单不能Checked?一级菜单却可以
解决方案 »
- 求一个c# 的邮件管理类库
- 菜鸟级的 button按钮 问题~~~
- 剪切板复制动画后就不会动了,怎样才能让他粘贴后还能动
- 请问如何用HttpWebResponse和HttpWebRequest接收自动刷新的数据?
- 使用ReportViewer控件的c\s程序,在部署客户机时都需要安装哪些文件???谢谢先辈指教~~~
- 如何判断一个数组中的不为null的对象总数是否为0
- 谁用c#做过marc数据格式与数据库之间都转换?
- 准备辞职了,过年后走人,送发大行动。
- VisualAge和VisualCafe分别是干什么的,在他们工具下的语言是什么?
- c#桌面应用程序怎么做安装程序给没装.NET框架的机器使用????????急
- List<MyClass1> 类型的数据如何转换为List<MyClass2>类型的数据
- 数据归一化
把下面的代码添加到InitializeComponent函数试试:
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 26);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2});
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem1.Text = "toolStripMenuItem1";
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Checked = true;
this.toolStripMenuItem2.CheckState = System.Windows.Forms.CheckState.Checked;
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem2.Text = "toolStripMenuItem2";
是因为我的一级菜单单击的时候相应的是MyMenu_itemChecked()事件
二级菜单为什么不能相应这个事件呢?
是因为我的一级菜单单击的时候相应的是MyMenu_itemClicked()事件
二级菜单为什么不能相应这个事件呢?
为啥呢?
例如:
this.toolStripMenuItem2.CheckedChanged += new System.EventHandler(this.toolStripMenuItem2_CheckedChanged);
上面的toolStripMenuItem2是二级菜单,toolStripMenuItem2_CheckedChanged函数相当于MyMenu_itemClicked;
查找你的代码中是否也有对应的代码。