|
-
Dec 17th, 2001, 04:12 AM
#1
Thread Starter
New Member
Zoom in and out with VB
Hello
We are developing one tools for GIS related Projects.
In this tools we draw lines and points on the vb form
by taking values form the text file.
Every thing is fine up to drawing of the lines and points.
Now we want to add Zoom in and Zoom out functionality to
that.
We deviding the form as per the min and max values which
are taken from the text file for the first time.
After that i want to set up the min and max values for
the map as per mouse clicks. This mouse clicks are for
, We drag the mouse to select the part that is to be Zoomed.
For this i want min and max (x and y)values.
At present i am taking mouse down values for minx and miny.
and mouse up values for maxx and maxy values.
but according to i am not getting exactly what i want.
Below is the code to draw line, reading values from the
text file.This is only the part that is which convert or
divides the form as per min and max values which are read
from the text file.
dx = 768 / ((maxx - minx))
dy = 521 / ((maxy - miny))
diffx1 = Abs(((minx - X1)) * dx)
diffy1 = Abs(((miny - Y1)) * dy)
diffx2 = Abs(((minx - X2)) * dx)
diffy2 = Abs(((miny - Y2)) * dy)
Newy1 = Totalheight - (diffy1)
Newy2 = Totalheight - (diffy2)
Line (diffx1, Newy1)-(diffx2, Newy2), QBColor(5)
Now i want to write code for the Zoom.
Can any one help me on this.
If u want any clarifications feel free to ask
Thank in advance
-
Dec 17th, 2001, 06:01 PM
#2
Frenzied Member
That's easy, try this formula:
NewX = OriginalX * PercentZoom / 100
Use that for both the X and Y coordinate of the points in the lines, it should work fine
-
Dec 18th, 2001, 02:11 AM
#3
Thread Starter
New Member
Hello
I am unable to understand what is newx and originalx
in this formula
NewX = OriginalX * PercentZoom / 100
Can u explain once again(in detailed).
If u want i can send u VB form and code on which i am
working and what i want.
Thanks
-
Dec 18th, 2001, 07:37 AM
#4
-
Dec 21st, 2001, 04:59 AM
#5
Thread Starter
New Member
reply
Send me your e-mail id to [email protected]. I will send my attachment to your id,because you can get better understand of my problem.
-
Dec 23rd, 2001, 06:18 PM
#6
Frenzied Member
It's not that hard, but ok
-
Dec 23rd, 2001, 07:52 PM
#7
Good Ol' Platypus
Basically any X (left) parameters of stuff you're drawing would go into that zoom "filter". Say you have 2x zoom:
VB Code:
Obj.ZoomX = Obj.X * 200 / 100
That would be the code for doing what you are doing. That is only hypothetical, if you had a UDT for the objects inside.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|