Hi,
I have a context menu, which is used for each of 6 labels on my form. That
is, right-clicking any of the labels will bring up the same context menu.
Once the user clicks the menu, the clicked MenuItem fires an event:
menuItem1_Click(object sender, System.EventArgs e)
How can tell which of the 6 labels the menu is being clicked over?
Thanks,
Norvin 4 5112
Hi Norvin,
You can you use ContextMenu.Popup event and before the menu becomes visible
(before you move the mouse) you can check which label is under the mouse
cursor
this.GetChildAtPoint(this.PointToClient(Control.Mo usePos));
I assume that Popup event's handler is a memeber of the control class that
hosts the labels.
Now you can save the reference to the label and use it latter when
MenuItem's Click event gets fired.
HTH
B\rgds
100
"Norvin Laudon" <no************@molinospamenergy.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl... Hi,
I have a context menu, which is used for each of 6 labels on my form. That is, right-clicking any of the labels will bring up the same context menu. Once the user clicks the menu, the clicked MenuItem fires an event:
menuItem1_Click(object sender, System.EventArgs e)
How can tell which of the 6 labels the menu is being clicked over?
Thanks, Norvin
Norvin Laudon wrote: Hi,
I have a context menu, which is used for each of 6 labels on my form. That is, right-clicking any of the labels will bring up the same context menu. Once the user clicks the menu, the clicked MenuItem fires an event:
menuItem1_Click(object sender, System.EventArgs e)
How can tell which of the 6 labels the menu is being clicked over?
Thanks, Norvin
Norvin,
Have you tried looking at the object sender in your parameter?
hth,
Jonel
The sender is the MenuItem, which doesn't contain info about what control
the mouse was clicked on.
thanks,
Norvin
"Jonel Rienton" <csharp@nospam_here.core.com> wrote in message
news:3FC27165.7080801@nospam_here.core.com... Norvin,
Have you tried looking at the object sender in your parameter?
hth, Jonel
100,
"100" <10*@100.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi Norvin, You can you use ContextMenu.Popup event and before the menu becomes
visible (before you move the mouse) you can check which label is under the mouse cursor this.GetChildAtPoint(this.PointToClient(Control.Mo usePos)); I assume that Popup event's handler is a memeber of the control class that hosts the labels. Now you can save the reference to the label and use it latter when MenuItem's Click event gets fired.
Thanks, that's the ticket...
Norvin "Norvin Laudon" <no************@molinospamenergy.com> wrote in message news:%2***************@tk2msftngp13.phx.gbl... Hi,
I have a context menu, which is used for each of 6 labels on my form.
That is, right-clicking any of the labels will bring up the same context
menu. Once the user clicks the menu, the clicked MenuItem fires an event:
menuItem1_Click(object sender, System.EventArgs e)
How can tell which of the 6 labels the menu is being clicked over?
Thanks, Norvin
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rakesh |
last post by:
Hi,
I am able to obtain a MenuItem object's Name property @
design-time, but am not able to get the same @ run-
time...why?
And since MenuItem doesn't inherit from Control class,
it's not...
|
by: Claus Holm |
last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather
than making the menuitems public, I'd go for a public method in the parent
form to do the change, but when I call the...
|
by: Claire |
last post by:
When I run the following code through on the first round, my sub-menu
(branched off mnuOpenPorts menuitem) shows a nice list of ports.
When it gets run through on the 2nd pass, the sub menu...
|
by: Claire |
last post by:
Sorry Ive added this twice (sortof) but if I'd added an addendum to the
first one then this would probably have been ignored.
This problem affects a ContextMenu attached to a NotifyIcon object. I...
|
by: M Shafaat |
last post by:
Hi,
I want to develop an application with menus. I want to make only one event
handler method which handles a whole group of menu items by firstly
identifying which MenuItem sends the click event...
| |
by: ZH |
last post by:
Hi There,
I have an application that runs from the systray. When the user right
clicks on the icon it shows the user a list of of menu items. That works
without a problem.
The problem is...
|
by: genojoe |
last post by:
Creating an enhanced menuItem with additional properties is easy to do. Is
there also a way to enhance the menuItem by adding an event to it?
I would like to have the MenuItem display a help...
|
by: Sharon |
last post by:
I have a Forms.ContextMenu with some Forms.MenuItem that has EventHandler for
the Click event.
The event handler function has the following signature:
private void OnMenuItemClick(object...
|
by: polocar |
last post by:
Hi,
I'm writing a program using Visual C# 2005 Professional Edition, and
I was trying to assign multiple MainMenu objects (one by one, of
course) to the same Form (let's suppose 2 MainMenu...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |