I can think of two ways to do this:
To have a context menu for each picturebox and use the tag property to
write the name of the corresponding picturebox.
or
have one shared context menu among them. Handle the click event of that
menu item. cast the sender to a menu item and menuitem.owner is the
context menu. Now, you can get the location of the context menu and
compare it to the location of the picturebox. ie
if contextmenu.left > picturebox1.left and contextmenu.left <
picturebox1.right and contextmenu.top> picturebox1.top and
contextmenu.top < picturebox1.bottom then
' the right click was over picturebox1
else if ....
end if
I prefer the second way.
Ahmed
wxnut wrote:
In VB 2005 I have six seperately named picture boxes (arranged in a table
layout control) in which I plot different X/Y data lines. I would like to be
able to right-click on a specific picture box (say, plot #3) and select a
different line color for that one plot.
How can I figure out which of the six plots is the one in question when
right-clicking on it? I can easily change the line color using the context
menu control, but I don't know which plot to apply to color change to. The
'sender' object does not give me any info from which picture box the click
event originated.
thanks