Thursday, December 11, 2008

USING THE PICTUREBOX

In this program, we insert a PictureBox and a Button into the form. Make sure to set the SizeMode property of the PictureBox to StretchImage so that the whole picture can be viewed in the picture box. Key in the code as shown below and you can load an image from a certain image file into the PictureBox.

Sample:


Code:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'To load an image into the PictureBox from an image file
PictureBox1.Image = Image.FromFile("c:\Users\Public\Pictures\Sample Pictures\Frangipani Flowers.jpg")

End Sub

No comments:

Post a Comment