OnMouseOverOnMouseButtonDown...

  • Thread starter Thread starter Thorbjørn Jørgensen
  • Start date Start date
T

Thorbjørn Jørgensen

Hi
I am creating a usercontrol which is inheriting from the UserControl class.
I would like to detect when the mouse is moved into the control when the
mouse button is down?
I have tried to use the OnMouseOver event, combined with some detection on
if the mouse button is down, but the OnMouseOver event does not seem to be
fired at all.
Does anybody have an suggestion on how to do this?

Regards
Thorbjørn
 
Try to use the OnMouseMove event.
I don't understand exactly why you need to know if the mouse button is
pressed when it's moving on your control. If you try to catch a DragDrop
session, you should use the appropriate event, for example OnDragEnter,
OnDragOver, etc...

HTH,
Mephiston
 
Hi Mephiston
Try to use the OnMouseMove event.
I don't understand exactly why you need to know if the mouse button is
pressed when it's moving on your control. If you try to catch a DragDrop
session, you should use the appropriate event, for example OnDragEnter,
OnDragOver, etc...

I know that the post was not that well informative but I tried to simplify
the question. I am creating a table like control where each cell is
inheriated from the UserControl Class. To be able to do a selection of
multiple cells i need to detect when the mouse enters a cell and the mouse
button is pressed down. I think i have tried the Drag events but could not
make them work. I do not know why, but it could be that no object is
actually dragged or some thing?
I hope this describes what I want to do a little more clearly and that some
body have a suggestion on how to overcome this problem...

Regards
Thorbjørn
 
Hi,
Now the problem is more clear.
At the moment I really don't know if there is a way to catch the event that
you need.

Alternatively, you can set a flag when the right mouse button in pressed on
or released on a UserControl, then when the OnMouseMove event is raised by
another control, you can check that flag to know if the right mouse button
is still pressed and so you can do what you need to.

HTH,
Mephiston
 
Back
Top