C#中的下拉菜单项 [英] Dropdown menu items in c#
本文介绍了C#中的下拉菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个下拉菜单,从中可以选择可用的打印机.我可以显示可用的打印机,到目前为止没有问题.但是,如何识别是否有人单击菜单项?
I.E.
Hi,
I''m trying to make a dropdown menu where I can select an available printer. I can display the available printers, no problems so far. But how can I recognize if someone clicks on the menu item?
I.E.
string printername = "GX430t" // note: this is a variable name, depends on the printer name installed.
select printerNameMenuItem.DropDownItems.Add(printername); // here do I add the new printer to the menu item.
如何向添加的项添加事件,该事件在用户单击菜单项时激活?
How do I add an event to the added item, which activates when the user clicks on the menu item?
推荐答案
在Menu1_MenuItemClick事件上设置刹车点,您将获得您的解决方案.
Put a brake point on Menu1_MenuItemClick event, you will get your solution.
这篇关于C#中的下拉菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文