Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'define GDI+ context representing a form
Dim GdiSurface As Graphics
GdiSurface = Me.CreateGraphics
'draw a thick curve
Dim CurvePen As New Pen(Color.Plum, 30)
Dim CurvePoints() As Point = {New Point(10, 100), New Point(50, 80), New Point(200, 200)}
GdiSurface.DrawCurve(CurvePen, CurvePoints)
'draw rectangle
Dim RecPen As New Pen(Color.Crimson, 10) 'perimeter
Dim RecBrush As New SolidBrush(Color.LightBlue) 'paint the body
GdiSurface.DrawRectangle(RecPen, 10, 10, 200, 30)
GdiSurface.FillRectangle(RecBrush, 10, 10, 200, 30)
'Release GDI context
GdiSurface.Dispose()
End Sub
|