By Kardi Teknomo, PhD .

< Previous | Next | VB Tutorial | Contents >

VB Picture Box

We start our project by adding picture box into our form, to make it resizable and become a drawing canvas. Click here to download the code

  1. Open a new Standard Exe Project
  2. Change the Name Property of Form1 into frmMap , then the Caption property into My Canvas .
  3. Drag and drop Picture Box from the Toolbox into the form frmMap .
  4. Change the Name property into picMap
  5. Change the AutoRedraw property to True. This will automatically redraw your picture again after other form goes over your picture box.
  6. Change the AutoSize Property to True so that the picture box will be also be resize when we change the size of the form. Type this code in the Form_Resize :

Private Sub Form_Resize()
picMap.Width = Me.Width - 120
picMap.Height = Me.Height - 400
End Sub