Results 1 to 7 of 7

Thread: Zoom in and out with VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    3

    Arrow 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

  2. #2
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    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
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    3
    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

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    The OriginalX is the X position you have. NewX is the X position where it should be once it's zoomed
    Just don't forget to do it for both the X and Y coordinates of ALL points
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    3

    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.

  6. #6
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    It's not that hard, but ok
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Basically any X (left) parameters of stuff you're drawing would go into that zoom "filter". Say you have 2x zoom:
    VB Code:
    1. 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
  •  



Click Here to Expand Forum to Full Width