Getting (x,y) of mouse

L

Lio

I have a form with many controls and labels. I have some
logic that displays help based on the (x,y) of the mouse
when clicked. My problem is that I would like the
MouseDown event to be only at the detail section of the
form, but when ever I have a label, the MouseDown of the
label is active.

Can I make a "global" Mousedown event that works on labels
and everywhere else on my form without having to put the
code on each labels MouseDown event?
 
J

Jesper F

Hi Lio,

I had a problem very similar to yours a while back. I used the x,y position
to simulate dragging and dropping buttons around on the form.
What I ended up doing may or may not be useful to you. But what I did was to
place a large transparent commandbutton over the area in which I needed to
catch the x,y coordinates. In my case this large transparent button covered
a lot of other textboxes etc, but allowed me to catch the x,y wherever the
cursor was. Knowing the size of the form, the position of the other controls
etc. it was possible to calculate what underlying control the cursor was
passing (for example for the mouseup event).
Maybe this could help you.

Jesper
 
L

Lio

That actually does the trick! Thanks.

I had tried with a "rectangle" but with no fill it was
just an edge - so it didn't catch all coordinates...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top