Question How to get X&Y coord when using MouseHover and set MouseHover-time and -size sysparas

Thonord

Member
Joined
Oct 25, 2012
Messages
23
Programming Experience
10+
How to get X&Y coord when using MouseHover and set MouseHover-time and -size sysparas

I have information related to locations in bitmaps. I extract the info and process as needed by using the MouseClick event's e. (X&Y). Works OK, but I have discovered the MouseHover event and it seems promising.

However, its e.MouseEventArgs does not include X and Y. I have found a workaround, using MouseMove and storing the e.(X&Y)'s in global variables and reading the variables in MouseHover, I'm sure there is a properer way to do it.

Also, I find the default SystemParameters for MouseHover -Time and -Size "limiting" to my purposes.
Problem is, they are ReadOnly.

I have found* how to change other ReadOnly stuff like AutoscrollPosition by declaring a New one (pnlMainImage.AutoScrollPosition = New Point(Math.Abs(CurrentPoint.X), Math.Abs(CurrentPoint.Y))) , but Micrcrosoft wants to know why - when I try that approach on the SystemParameters and .Net crashes.
(It brings back memories of using the Dos tool Debug.exe Write and not paying attention to the drive number. That was a place where an: "Are you really, really, REALLY sure yoe want to do this? would have been appropriate:embarrassed:" )
But I digress.

* Found on this forum

1. What is the smart way to read the mouse position with MouseHover?

2. How do I change the SystemParameters for MouseHoverSize and MouseHoverSize.

As always

Tom

Which is actually a pun in norwegian:)
 
The Control.MousePosition property will give you the mouse position in screen coordinates. The PointToClient method of any control will convert those coordinates to its own client area.
 
Again thanks a lot guys.


jmcilhinney, so All I have to do is download .-NET Framework 4.5? RogerWilco!


JohnH, on the issue of MouseHover parameters - I give up, but not without trying.
I now have these two following functions, curtisy of a free C# - vb converter


Private Function GET_X_LPARAM(lParam As LPARAM) As Integer
End Function


Private Function GET_Y_LPARAM(lParam As LPARAM) As Integer
End Function


They would give me the high and low-order shorts of the returned integer, representing the X and Y location - if only I knew who, what and how lParam is. My guess is that it is related to an e although not the e in the MouseHover event. Its not enumerating a MyMouseHover = 0x2A1 either.


Then I found something like: Tracking Hover is suspended if MyMouseHover is called, and I have to generate a Mouse tracking event again to unsuspend it. The only way I could think of was by moving the mouse off the PictureBox and back on again. Not a proffesional way to do it.


At first I was mad at Microsoft who didn't make the assuption that "When providing a Hover event, somebody might want to know WHERE and more than once - before now, in Framework 4.5? Then I realised I was unfair, so:
Sorry Microsoft - I know its not your fault. Gosh I wish the mouse was born at the same time as the PC. Then it would have been born with its own interupt.


I'll look at 4.5, but I'll keep my own solution as a fall-back. I have expanded it a little. Including a Beep if something is found and a Boop if not. Not really happy, because the only user, me, will be reminded by the Beep or Boop - that I'm getting old.
 
Back
Top