contextMenu动态调用时的问题?
这个contextMenu是在运行时生成的,包括其中的菜单也是动态生成的。
private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if ((e.KeyCode == Keys.A)&&(e.Control==true))
{
str=Microsoft.VisualBasic.Interaction.InputBox("input","abc","abcd",100,100);
//调用VB的inputBox();
contextMenu1.MenuItems.Add(str);
}
Point ClickPoint = new Point(100,100);
if ((e.KeyCode == Keys.S)&&(e.Control==true))
{
contextMenu1.Show(this,ClickPoint);
}
问题是如何响应菜单中选项,要用那个事件,我用了menuItem1_Click(object sender, System.EventArgs e)没有反应.