Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
' Make a Bitmap to fill the PictureBox.
Dim wid As Integer = Me.ClientSize.Width
Dim hgt As Integer = Me.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim gr As Graphics = Graphics.FromImage(bm)
' Draw some stuff.
Dim w, h As Integer
Dim num As New Random
For i As Integer = 1 To 100
w = num.Next(10, 50)
h = num.Next(10, 50)
gr.FillEllipse( _
New SolidBrush(RandomQBColor()), _
num.Next(0, wid - w), num.Next(0, hgt - h), _
w, h)
Next i
' Make the image permanent.
Me.PictureBox1.Image = bm
End Sub
|