Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class SubPath
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)
Dim g As Graphics = Me.CreateGraphics()
g.Clear(Me.BackColor)
Dim path As New GraphicsPath
Dim pts As Point() = {New Point(40, 80), New Point(50, 70), New Point(70, 90), New Point(100, 120), New Point(80, 120)}
path.StartFigure()
path.AddArc(250, 80, 100, 50, 30, -180)
path.AddLine(180, 220, 320, 80)
path.CloseFigure()
path.StartFigure()
path.AddLine(50, 20, 5, 90)
path.AddLine(50, 150, 150, 180)
path.AddCurve(pts, 5)
path.CloseAllFigures()
path.StartFigure()
path.AddLine(200, 230, 250, 200)
path.AddLine(200, 230, 250, 270)
g.DrawPath(New Pen(Color.FromArgb(255, 255, 0, 0), 2), path)
g.Dispose()
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