|
-
May 15th, 2008, 06:46 PM
#1
Thread Starter
Junior Member
[RESOLVED] [2008] Determine where contect menu was called from
It seems to me that there should be a simple way to determine which control the user right-clicked to bring up the context menu.
I have several identical controls on a form that display different data, but the context menu options are the same for each control. I'd much prefer to create just one context menu with associated code, rather than duplicate that stuff for each control on my form.
Obviously, to do that I must be able to tell which control was right-clicked on so that I can tailor the menu item's response to that control.
Does anybody have any ideas on how this is accomplished? I thought the answer might be in the sender parameter that is passed to the menu item handler, but that only tells me which menu item was selected.
-
May 15th, 2008, 08:56 PM
#2
Re: [2008] Determine where contect menu was called from
It seems to me that there should be a simple way to determine which control the user right-clicked to bring up the context menu.
That seems reasonable. It's also reasonable that, if there is a way they'd have mentioned it in the documentation. Reading the documentation for the ContextMenuStrip class we find the SourceControl property, which is is described as:
Gets the last control that caused this ContextMenuStrip to be displayed.
I'd suggest making a point of reading the documentation first in future.
-
May 16th, 2008, 12:37 AM
#3
Thread Starter
Junior Member
Re: [2008] Determine where contect menu was called from
Actually, I did read the documentation, but I seemed to have missed that property
-
Jun 10th, 2008, 11:47 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|