Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class DrawLines
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 = e.Graphics
Dim pn As New Pen(Color.Blue)
' Rectangle rect = new Rectangle(50, 50, 200, 100);
Dim pt1 As New Point(30, 30)
Dim pt2 As New Point(110, 100)
g.DrawLine(pn, pt1, pt2)
' Create a pen with red color and width 3
Dim redPen As New Pen(Color.Red, 3)
' Create an array of points
Dim ptsArray As PointF() = {New PointF(10.0F, 20.0F), New PointF(50.0F, 40.0F), New PointF(220.0F, 120.0F), New PointF(120.0F, 20.0F)}
g.DrawLines(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
|