Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
Dim pts() As Point = { _
New Point(50, 50), _
New Point(250, 150), _
New Point(150, 200), _
New Point(100, 90), _
New Point(50, 120) _
}
e.Graphics.SmoothingMode = _
Drawing2D.SmoothingMode.AntiAlias
' Draw the curve.
e.Graphics.DrawClosedCurve(Pens.Black, pts)
' Draw the points.
For i As Integer = 0 To pts.Length - 1
e.Graphics.FillRectangle(Brushes.White, pts(i).X - _
2, pts(i).Y - 2, 4, 4)
e.Graphics.DrawRectangle(Pens.Black, pts(i).X - 2, _
pts(i).Y - 2, 4, 4)
Next i
End Sub
|