Click here to Skip to main content
15,947,389 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I am trying to resize a picturebox within the form and also move it around the form within the form and drag it around, can anyone please help I can't find how to do either of those 2 on the Internet.
Posted

1 solution

Below provided shows how you can re-size picture Box

Private MyImage As Bitmap
Public Sub ShowMyImage(fileToDisplay As String, xSize As Integer, _
                        ySize As Integer)
    ' Sets up an image object to be displayed.
    If (MyImage IsNot Nothing) Then
         MyImage.Dispose()
    End If

    ' Stretches the image to fit the pictureBox. 
    pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    MyImage = New Bitmap(fileToDisplay)
    pictureBox1.ClientSize = New Size(xSize, ySize)
    pictureBox1.Image = CType(MyImage, Image)
 End Sub 
 
Share this answer
 
Comments
ajay.anilmaddi 5-Mar-12 5:45am    
please Help me ,I need code for PictureBox Move and resize in same form and for same picture

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900