1
我想確定所選上下文菜單項的索引。但我並不想建立每個菜單項獨特的事件處理程序...我怎麼做這個我該如何獲取發射上下文菜單項的索引
MenuItem mi= StatusContextMenu.MenuItems.Add("Set option");
mi.MenuItems.Add(0,new MenuItem("Set to A", new EventHandler(SetLetter)));
mi.MenuItems.Add(1,new MenuItem("Set to B", new EventHandler(SetLetter)));
mi.MenuItems.Add(2,new MenuItem("Set to C ", new EventHandler(SetLetter)));
mi.MenuItems.Add(3,new MenuItem("Set to D", new EventHandler(SetLetter)));
private void SetLetter(object sender, System.EventArgs e)
{
index = ????
}
C#.NET 2.0
那太棒了......我不知道我能做到這一點......它開創了在其他領域possibilitys。謝謝 – fishhead 2010-05-19 03:43:20