Hi
I am having problems working out if the mouse pointer is within the
control bounds within the OnMouseMove method:
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
Debug.WriteLine(Me.Bounds.Contains(e.X, e.Y))
End Sub
This always returns false even when the mouse is being moved over the
control. I would expect it only to return false if the mouse was being
moved outside the control when the mouse button was originally pressed
over the control.
MSDN suggests that i am using it correctly: http://msdn.microsoft.com/library/de...ainstopic1.asp
Anyone know where i am going wrong?
Thanks
Tom 8 2761
"Tom" <re***@to.group> schrieb Hi
I am having problems working out if the mouse pointer is within the control bounds within the OnMouseMove method:
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
Debug.WriteLine(Me.Bounds.Contains(e.X, e.Y))
End Sub
This always returns false even when the mouse is being moved over the control. I would expect it only to return false if the mouse was being moved outside the control when the mouse button was originally pressed over the control.
MSDN suggests that i am using it correctly:
http://msdn.microsoft.com/ library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdr awingrectangleclasscontai nstopic1.asp
Anyone know where i am going wrong?
Bounds returns coordinates relative to the parent of the control, whereas
e.x and e.y are relative to the top left corner of the control.
Use
Debug.WriteLine(Me.ClientRectangle.Contains(e.X, e.Y))
BTW, don't forget to call
MyBase.OnMouseMove(e)
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
>On Thu, 20 May 2004 13:21:00 +0200, "Armin Zingler" <az*******@freenet.de> wrote: Bounds returns coordinates relative to the parent of the control, whereas e.x and e.y are relative to the top left corner of the control.
Use Debug.WriteLine(Me.ClientRectangle.Contains(e.X, e.Y))
BTW, don't forget to call MyBase.OnMouseMove(e)
Armin, that's fantastic, thanks mate.
* Tom <re***@to.group> scripsit: I am having problems working out if the mouse pointer is within the control bounds within the OnMouseMove method:
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
Debug.WriteLine(Me.Bounds.Contains(e.X, e.Y))
End Sub
This always returns false even when the mouse is being moved over the control. I would expect it only to return false if the mouse was being
Mouse events will only be generated for the control under the mouse, so
you won't receive an event when the mouse is moved outside the control.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
On 20 May 2004 16:16:47 +0200, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote: * Tom <re***@to.group> scripsit: I am having problems working out if the mouse pointer is within the control bounds within the OnMouseMove method:
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
Debug.WriteLine(Me.Bounds.Contains(e.X, e.Y))
End Sub
This always returns false even when the mouse is being moved over the control. I would expect it only to return false if the mouse was being
Mouse events will only be generated for the control under the mouse, so you won't receive an event when the mouse is moved outside the control.
If the mouse button is pressed over the control and remains pressed as
you move off the control, the event will still fire as the mouse
moves, likewise the OnMouseUp event.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb This always returns false even when the mouse is being moved over the control. I would expect it only to return false if the mouse was being
Mouse events will only be generated for the control under the mouse, so you won't receive an event when the mouse is moved outside the control.
No, it is also received outside as stated in the sentence you quoted only
the first half. ;-)
"I would expect it only to return false if the mouse was being
moved outside the control when the mouse button was originally pressed
over the control."
--
Armin
* Tom <re***@to.group> scripsit: This always returns false even when the mouse is being moved over the control. I would expect it only to return false if the mouse was being
Mouse events will only be generated for the control under the mouse, so you won't receive an event when the mouse is moved outside the control.
If the mouse button is pressed over the control and remains pressed as you move off the control, the event will still fire as the mouse moves, likewise the OnMouseUp event.
OK, I didn't think of that. Thank you for making me aware that I missed
this case.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
* "Armin Zingler" <az*******@freenet.de> scripsit: No, it is also received outside as stated in the sentence you quoted only the first half. ;-)
"I would expect it only to return false if the mouse was being moved outside the control when the mouse button was originally pressed over the control."
Sorry :-(. I took 13 hours of sleep but I am still tired...
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
We see it, however now I know I will have patience
Cor Sorry :-(. I took 13 hours of sleep but I am still tired... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: BadOmen |
last post by:
I want my program to send a mouse click to the window at the current mouse
position, how do I do that?
Example:
I have my mouse over a button in Word and then my program is sending the
left...
|
by: red |
last post by:
mouse events when the mouse is on a "child control"
hi everyone;
my problem:
I have a userControl
in this usercontrol, I have a child control (a button)
when the mouse moves over the...
|
by: harrylmh |
last post by:
Hi,
Here's the problem. Whenever the mouse goes out of the form or any
control tat handles mouse move, the mouse stop sending it's
coordinates back to the program. How can I correct this? What's...
|
by: Benny Raymond |
last post by:
In my attempt to make a macro recording program where i can then
playback mouse movements i'm running into a big problem:
I'm trying to simulate the movement of the mouse to a point on the...
|
by: Charles Law |
last post by:
Sorry for reposting this question, but I did not get a single answer last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped...
|
by: Morten Snedker |
last post by:
If I have a number of random applications open, move the mouse cursor
to a given position and do a click, the application gets the focus.
That is what this simple code should illustrate:
Dim...
|
by: markszlazak |
last post by:
In the following script, a control displays (black box) in each table
cell once you mouse over the cell. Mouse down on the control to change
the mode of the table. Drag the mouse over cells in the...
|
by: vidishasharma |
last post by:
Hi,
I have a windows from with few controls over it. Now I have to see if
the cursor goes outside the bounds of the windows form then I have to
close the form.
I added mouse leave for the...
|
by: mike |
last post by:
I have the opportunity to rescue a project that
uses a mouse to sense the relative position of a machine.
The hardware is built...just needs to be programmed.
Stop snickering!!! I didn't do it...I...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |