Imports System
Imports System.Windows.Forms
Imports System.Drawing.Text
Imports System.Drawing
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim myform As Form = New Form1()
Application.Run(myform)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
' Define the Bezier curve's control points.
Dim pts() As Point = { _
New Point(100, 100), _
New Point(20, 10), _
New Point(50, 200), _
New Point(200, 150) _
}
' Connect the points with dashed lines.
Dim dashed_pen As New Pen(Color.Black, 0)
dashed_pen.DashStyle = Drawing2D.DashStyle.Dash
For i As Integer = 0 To 2
e.Graphics.DrawLine(dashed_pen, pts(i), pts(i + 1))
Next i
' Draw the Bezier curve.
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Dim bez_pen As New Pen(Color.Black, 3)
e.Graphics.DrawBezier(bez_pen, pts(0), pts(1), pts(2), pts(3))
End Sub
End Class
|