Public Class Form1 ' Create and display a bitmap. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Make the Bitmap. Dim bm As New Bitmap(200, 150) ' Make an associated Graphics object. Using gr As Graphics = Graphics.FromImage(bm) ' Draw. gr.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias gr.Clear(Color.Yellow) Using thick_pen As New Pen(Color.Red, 5) gr.DrawEllipse(thick_pen, 3, 3, 195, 145) thick_pen.Color = Color.Green gr.DrawLine(thick_pen, 3, 3, 197, 147) thick_pen.Color = Color.Blue gr.DrawLine(thick_pen, 3, 147, 197, 3) End Using End Using ' Display the result in a PictureBox. picResult.Image = bm End Sub End Class |