'create a bitmap the size of the picturebox
Dim bmp As Bitmap = New Bitmap(PictureBox2.Width, PictureBox2.Height)
'create a graphics object from the bitmap
Dim g As Graphics = Graphics.FromImage(bmp)
'draw on the bitmap via the graphics object
'a black rectangle at location 10,10 of width and height=1
g.FillRectangle(Brushes.Black, 10, 10, 1, 1)
'set the image property of the picturebox to the bitmap
PictureBox2.Image = bmp
'clean up resources
g.Dispose()