在PictureBox1上畫紅色的實心圓:Private Sub DrawCircle(ByVal cp As Point, ByVal radius As Integer, ByVal color As Brush) Dim gr As Graphics gr = PictureBox1.CreateGraphics Dim rect As Rectangle = New Rectangle(cp.X - radius, cp.Y - radius, 2 * radius, 2 * radius) gr.DrawEllipse(Pens.Black, rect) gr.FillEllipse(color, rect)End SubPrivate Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click DrawCircle(New Point(120, 100), 80, Brushes.Red) End Sub
在PictureBox1上畫紅色的實心圓:Private Sub DrawCircle(ByVal cp As Point, ByVal radius As Integer, ByVal color As Brush) Dim gr As Graphics gr = PictureBox1.CreateGraphics Dim rect As Rectangle = New Rectangle(cp.X - radius, cp.Y - radius, 2 * radius, 2 * radius) gr.DrawEllipse(Pens.Black, rect) gr.FillEllipse(color, rect)End SubPrivate Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click DrawCircle(New Point(120, 100), 80, Brushes.Red) End Sub