LEADTOOLS Support
Imaging
Imaging SDK Questions
Mouse events only give coordinates in Twips using Visual Basic (VB) 6.0
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, August 9, 2006 7:06:31 AM(UTC)
Groups: Registered, Tech Support
Posts: 207
Was thanked: 3 time(s) in 3 post(s)
For each Mouse event (MouseMove, MouseDown, MouseUp, etc) we have the following documented for the X and Y parameters: The unit of measure is determined by the form that contains the Main Control.
However, if you actually try and process these events you'll notice that no matter what ScaleMode you set the Form, the values are always give in Twips. This is due to a flaw in Visual Basic 6.0.
A workaround for this issue is to divide each value by Screen.TwipsPerPixelX and Screen.TwipsPerPixelY.
For example....you would change your code from
ClientX = x
ClientY = y
to:
ClientX = x / Screen.TwipsPerPixelX
ClientY = y / Screen.TwipsPerPixelY
This will give you client coordinates in pixels.
Travis Montgomery
Senior Sales Engineer
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#2
Posted
:
Wednesday, January 9, 2008 12:45:19 AM(UTC)
Groups: Registered
Posts: 7
hi...
i just like to know... how do i get the x and y coordinates of the image inside the Lead1. Ive also tried the example above but ive found out that when the image width and height is greater than the width and height of lead1...when you scroll down to the bottom of an image its only display the same x and y coordinates eventhough the your pointing to the heighest value of the image....
for example the
Image info:
infoWidth=1039 and InfoHeight=335
Lead1 control:
Lead1 width=500
Lead1 Height=200
when you point the mouse the last of the control width and the image value is 1039
x value is still 500..
any HELP?
#3
Posted
:
Wednesday, January 9, 2008 4:55:25 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Use the function ClientToBitmap of the Main Control and pass in the X and Y values you wish you translate to bitmap coordinates. The resulting values will be stored in the ConvertX and ConvertY properties of the Main Control.
LEADTOOLS Support
Imaging
Imaging SDK Questions
Mouse events only give coordinates in Twips using Visual Basic (VB) 6.0
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.