cutieann12 0 Newbie Poster

I have this function in zooming in and zooming out the image in picturebox however this code only works to a single image. The problem is i am loading images in my form and what i want is when i choose the image it will do the function and it will have the transformation i want. Anyone has idea on how will i do it? Any help is appreciated. Thanks.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.txtScale.Text = txtScale.Text + 0.05
        Dim scale_factor As Single = Single.Parse(txtScale.Text)


        Dim bm_source As New Bitmap(picSource.Image)


        Dim bm_dest As New Bitmap( _
            CInt(bm_source.Width * scale_factor), _
            CInt(bm_source.Height * scale_factor))


        Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)


        gr_dest.DrawImage(bm_source, 0, 0, _
            bm_dest.Width + 1, _
            bm_dest.Height + 1)


        picDest.Image = bm_dest
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.