Udi wrote:
I have a control "A" that displays a list of control "B".
How do I add the ability to insert a new "B" to the list through a
context menu?
I mean, What do I need to do in the event handler code?
Where do I find the location of the mouse when it was
right- clicked, and how do I find the relvant "B" that was clicked?
Sorry, I can't tell you like this, because it depends on the control you
use to show the list. Usually, controls that can be used to display a list
of objects, like grids, list boxes and similar controls, have methods that
allow you to find out which entry is shown at a specific position. Or they
might even pass that information in to the mouse click event handler, so
you don't have to query it yourself.
The location of the mouse is the easy part: just use the MousePosition
property or Cursor.Position, alternatively. But note that these methods
give you the mouse position in screen coordinates - you'll probably need
to convert them to control coordinates, using the PointToClient method.
Oliver Sturm
--
Expert programming and consulting services available
See
http://www.sturmnet.org (try /blog as well)