Is mouse cursor over the control?

B

Blaz Ziherl

I have this control that has no MouseEnter or MouseLeave events. How
could I find out whether the mouse cursor is over that control or not?
Is there an equivalent to the WindowFromPoint API function available
in VB.NET?

Regards,
Blaz Ziherl
(e-mail address removed)
 
A

Armin Zingler

Blaz Ziherl said:
I have this control that has no MouseEnter or MouseLeave events.

Don't all Controls have these events?
How could I find out whether the mouse cursor is over that control or
not? Is there an equivalent to the WindowFromPoint API function
available in VB.NET?

System.Windows.Forms.Control.PointToClient
System.Windows.Forms.Control.PointToScreen


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Blaz Ziherl) scripsit:
I have this control that has no MouseEnter or MouseLeave events. How
could I find out whether the mouse cursor is over that control or not?
Is there an equivalent to the WindowFromPoint API function available
in VB.NET?

Are you sure you don't have these events? From which base class does
your control inherit?

BTW: You can get the cursor's position using 'Cursor.Position' and then
using the controls' 'PointToClient' (and 'PointToScreen') methods to get
control coordinates.
 
B

Blaz Ziherl

Thanks for your help. I have solved the problem with the PointToClient method.

Thanks,
Blaz Ziherl
(e-mail address removed)
 

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