No announcement yet.

center on zoom in a frame

  • Filter
  • Time
  • Show
Clear All
new posts

  • center on zoom in a frame

    I am developing a form for emergency dispatching. One of the features of this dispatch sheet is that there are several maps in it that open on a seperate form. The map form has 4 maps that are picture files in an image. these images are in a frame. The different images are selected using option buttons. Given the background above, my problem is this. I have code that zooms in 50% each time the Click event for the image is fired. wht i am trying to do is make the zoomed view center where i clicked. this is the code that i have so far but it doesn't work all that spectacular, the closer I zoom in the further out of center the place i clicked gets untill it is out of view.

    Private Sub Layout_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        CurrentX = X
        CurrentY = Y
    End Sub
    Private Sub PlantLayout_Click()
    If Frame1.Zoom < 400 Then Frame1.Zoom = Frame1.Zoom + 50
    frmmap.Frame1.ScrollLeft = CurrentX - (Frame1.Width / 2)
    frmmap.Frame1.ScrollTop = CurrentY - (Frame1.Height / 2)
    End Sub
    Thanks for any help in advance,
    S. Tibbetts

  • #2
    Re: center on zoom in a frame

    Are these on a UserForm?


    • #3
      Re: center on zoom in a frame

      yes, it is a userform called FrmMaps in a frame called Frame1 and one of the 4 images is called PlantLayout. Sorry I wasn't more specific.