Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class LineCapAllStyles
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 x As Integer = 5
Dim y As Integer = 17
Dim the_pen As New Pen(Color.Black, 10)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.NoAnchor)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.Round)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.RoundAnchor)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.Square)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.SquareAnchor)
DrawLine(e.Graphics, x, y, Drawing2D.LineCap.Triangle)
End Sub
Private Sub DrawLine(ByVal gr As Graphics, ByRef x As Integer, ByRef y As Integer, ByVal style As Drawing2D.LineCap)
Dim the_pen As New Pen(Color.Black, 10)
the_pen.EndCap = style
gr.DrawString(style.ToString, Me.Font, Brushes.Black, x, y - 5)
gr.DrawLine(the_pen, x + 100, y, x + 150, y)
y += 25
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
|