/// <summary>
/// 绑定响应事件
/// </summary>
this.ListMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ListMenu_ItemClicked);
/// <summary>
/// 响应ItemMenu右键菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ItemMenu_ItemClicked(Object sender, ToolStripItemClickedEventArgs e)
{
//code...
}
可是ItemMenu_ItemClicked中并不能响应二级菜单的Click事件, 又不想一个个添加Click事件, 那么下面的方法也许可以帮到你:
往二级菜单的上级菜单添加DropDownItemClicked事件如:
this.CopyDetail.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(CopyDetail_DropDownItemClicked);
添加处理方法如:
void CopyDetail_DropDownItemClicked(object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e)
{
//code...
}
这样就可以响应了.
如此类推, 多级菜单亦可如此.