Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class DrawPath
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 greenPen As Pen = New Pen(Color.Green, 1)
Dim path As GraphicsPath = New GraphicsPath
path.AddLine(20, 20, 103, 80)
path.AddEllipse(100, 50, 100, 100)
path.AddLine(195, 80, 300, 80)
path.AddLine(200, 100, 300, 100)
path.AddLine(195, 120, 300, 120)
Dim rect As Rectangle = New Rectangle(50, 150, 300, 50)
path.AddRectangle(rect)
e.Graphics.DrawPath(greenPen, path)
greenPen.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
|