Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class DrawBeziers
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
' Drawing Beziers
Dim g As Graphics = e.Graphics
' Create a green pen.
Dim greenPen As New Pen(Color.Green, 2)
' Draw bezier
e.Graphics.DrawBezier(greenPen, 20.0F, 30.0F, 100.0F, 200.0F, 40.0F, 400.0F, 100.0F, 200.0F)
' Create pen.
Dim redPen As New Pen(Color.Red, 2)
' Create points for curve.
Dim p1 As New PointF(40.0F, 50.0F)
Dim p2 As New PointF(60.0F, 70.0F)
Dim p3 As New PointF(80.0F, 34.0F)
Dim p4 As New PointF(120.0F, 180.0F)
Dim p5 As New PointF(200.0F, 150.0F)
Dim p6 As New PointF(350.0F, 250.0F)
Dim p7 As New PointF(200.0F, 200.0F)
Dim ptsArray As PointF() = {p1, p2, p3, p4, p5, p6, p7}
e.Graphics.DrawBeziers(redPen, ptsArray)
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class