c#右键菜单子菜单的建立

 ToolStripItem t1 = new ToolStripMenuItem(TypeText);//新建一个菜单对象
  ((ToolStripDropDownItem)(contextMenuStrip1.Items[1])).DropDownItems.Add(t1);//将新建对象添加为contextmenustrip1d的序号为1的子菜单
   t1.Click += new EventHandler(t1_ToolStripMenuItem_Click);  //增加点击使事件       

 private void t1_ToolStripMenuItem_Click(object sender, EventArgs e)

{

/*这里面写点击事件*/

}

猜你喜欢

转载自blog.csdn.net/L_longqihang/article/details/81536502