LineCap.Triangle : LineCap « System.Drawing.Drawing2D « VB.Net by API






LineCap.Triangle

  
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class GetCapStyles
   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 blackPen As New Pen(Color.Black, 10)

        blackPen.StartCap = LineCap.Triangle
        blackPen.EndCap = LineCap.Triangle
        g.DrawLine(blackPen, 20, 10, 200, 10)
        blackPen.StartCap = LineCap.Square
        blackPen.EndCap = LineCap.Square
        g.DrawLine(blackPen, 20, 30, 200, 30)
        blackPen.StartCap = LineCap.ArrowAnchor
        blackPen.EndCap = LineCap.ArrowAnchor
        g.DrawLine(blackPen, 20, 50, 200, 50)
        blackPen.StartCap = LineCap.DiamondAnchor
        blackPen.EndCap = LineCap.DiamondAnchor
        g.DrawLine(blackPen, 20, 70, 200, 70)
        blackPen.StartCap = LineCap.Flat
        blackPen.EndCap = LineCap.Flat
        g.DrawLine(blackPen, 20, 90, 200, 90)
        blackPen.StartCap = LineCap.Round
        blackPen.EndCap = LineCap.Round
        g.DrawLine(blackPen, 20, 110, 200, 110)
        blackPen.StartCap = LineCap.RoundAnchor
        blackPen.EndCap = LineCap.RoundAnchor
        g.DrawLine(blackPen, 20, 130, 200, 130)
        blackPen.StartCap = LineCap.Square
        blackPen.EndCap = LineCap.Square
        g.DrawLine(blackPen, 20, 150, 200, 150)
        blackPen.StartCap = LineCap.SquareAnchor
        blackPen.EndCap = LineCap.SquareAnchor
        g.DrawLine(blackPen, 20, 170, 200, 170)
        blackPen.StartCap = LineCap.Flat
        blackPen.EndCap = LineCap.Flat
        g.DrawLine(blackPen, 20, 190, 200, 190)
        ' Dispose
        blackPen.Dispose()
        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

   
    
  








Related examples in the same category

1.LineCap.ArrowAnchor