请问如何得到右键菜单是哪个对象引发的?谢过了先。

纪俊 2002-07-25 08:35:32
请问如何得到右键菜单是哪个对象引发的?
比如说我在textBox1,textBox2都调用了一个contextMenu1。
如何在menuItem1_Click中得到调用它的是textBox1还是textBox2。
谢过了先。
...全文
77 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jhnhu 2002-07-26
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28000519

Remarks:
You can use this event to initialize the MenuItem objects before they are displayed. For example, if you use a ContextMenu for three TextBox controls and you want to disable certain menu items in the ContextMenu depending on which TextBox is displaying the shortcut menu, you can create an event handler for this event. You could use the SourceControl property to determine which TextBox is about to display the ContextMenu and disable the appropriate MenuItem objects.
纪俊 2002-07-25
  • 打赏
  • 举报
回复
?
不对,你没有理解我的意思!看错题了...
pdwling 2002-07-25
  • 打赏
  • 举报
回复
设置textBox1的属性contextMenu
选contextMenu1。
OK!

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧