如何知道在ContexMenueStrip中单击了哪个项目 [英] How to Know which item is click in ContexMenueStrip

查看:70
本文介绍了如何知道在ContexMenueStrip中单击了哪个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


i想知道在c#winform中的ContexMenue中点击了哪个项目。

hi
i want to know which item is clicked in ContexMenue in c# winform.

推荐答案

ContextMenuStrip有自己独立的事件:你可以将Expand项目Click事件发送到一个处理程序,将Collapse发送到另一个处理程序,或者你可以将它们发送到同一个处理程序并使用 sender 参数来决定点击哪个 - 它始终是控件(或表单或类依赖),它首先表示事件。
Each item in the ContextMenuStrip has it's own separate events: you could either send the "Expand" item Click event to one handler, and the "Collapse" even to a different handler, or you could send them both to the same handler and use the sender parameter to decide which was clicked - it is always the control (or form, or class depending) that signaled the event in the first place.


这篇关于如何知道在ContexMenueStrip中单击了哪个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆