Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, November 20, 2012 1:19:14 PM(UTC)
bhammerstrom

Groups: Registered
Posts: 4


OCX v16 Access mdb.
I have mousewheel zoom working with the image centered, but would like to get the cursor's position and zoom centered on the cursor. Is there an example?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 21, 2012 7:07:37 AM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


How exactly do you want the behavior? Do you want to zoom the entire bitmap but keep the point under the mouse cursor in its old position?

Or do you want to zoom a partial area, like a magnifying glass around the mouse cursor?

Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, November 26, 2012 8:01:06 AM(UTC)
bhammerstrom

Groups: Registered
Posts: 4


Your first description is what I am after. I have the zoom rectangle working. Now I need zoom wheel with the entire bitmap zoomed at increments of mouse wheel spins, with the area of the image remaining under the cursor's position.
 
#4 Posted : Wednesday, November 28, 2012 7:25:54 AM(UTC)

mohamed  
mohamed

Groups: Registered, Tech Support
Posts: 179


I used the following code in VB6 and it worked. Please try similar code in your application:

Dim xPos As Single, yPos As Single 'global variables

Private Sub Command1_Click()
LEAD1.Load "OCR1.TIF", 0, 0, 1
LEAD1.EnableMouseWheel = True
LEAD1.AutoScroll = False
End Sub

Private Sub LEAD1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
xPos = x
yPos = y
End Sub

Private Sub LEAD1_MouseWheel(ByVal nDelta As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
Dim factor As Double
If nDelta > 0 Then
factor = 0.9 * nDelta / 120
Else
factor = 1 / 0.9 * -nDelta / 120
End If

Dim xPos2, yPos2, w2, h2
xPos2 = (xPos * factor)
yPos2 = (yPos * factor)
w2 = (LEAD1.Width * factor)
h2 = (LEAD1.Height * factor)

LEAD1.ZoomToRect _
(xPos - xPos2) / Screen.TwipsPerPixelX, _
(yPos - yPos2) / Screen.TwipsPerPixelY, _
w2 / Screen.TwipsPerPixelX, _
h2 / Screen.TwipsPerPixelY
End Sub
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.062 seconds.