Results 1 to 6 of 6

Thread: zoom in and zoom out

Hybrid View

  1. #1
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: zoom in and zoom out

    Something similar
    Code:
    Private mPic As Picture
    Private mWidth As Single, mHeight As Single
    
    Private Sub Form_Load()
        Set mPic = LoadPicture("D:\pic1.JPG") '(Add the Path to your Picture here)
        mWidth = Picture1.ScaleX(mPic.Width, vbHimetric, Picture1.ScaleMode)
        mHeight = Picture1.ScaleY(mPic.Height, vbHimetric, Picture1.ScaleMode)
        
        Picture1.AutoRedraw = True
        Picture1.PaintPicture mPic, 0, 0
    End Sub
    
    Private Sub Command1_Click()
        ZoomPicture Picture1, 0.9
    End Sub
    Private Sub Command2_Click()
        ZoomPicture Picture1, 1.1
    End Sub
    
    Public Sub ZoomPicture(pct As PictureBox, zoom As Double)
        pct.Cls
        mWidth = mWidth * zoom
        mHeight = mHeight * zoom
        pct.PaintPicture mPic, 0, 0, mWidth, mHeight
    End Sub
    Last edited by jcis; Mar 14th, 2007 at 03:13 AM.

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