LineCap styles: LineCap.AnchorMask, LineCap.ArrowAnchor,LineCap.DiamondAnchor, LineCap.Flat : LineCap styles « 2D Graphics « VB.Net Tutorial






LineCap styles: LineCap.AnchorMask, LineCap.ArrowAnchor,LineCap.DiamondAnchor, LineCap.Flat
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.AnchorMask)
        DrawLine(e.Graphics, x, y, Drawing2D.LineCap.ArrowAnchor)
        DrawLine(e.Graphics, x, y, Drawing2D.LineCap.DiamondAnchor)
        DrawLine(e.Graphics, x, y, Drawing2D.LineCap.Flat)

    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








17.13.LineCap styles
17.13.1.Get Line CapStylesGet Line CapStyles
17.13.2.All LineCap stylesAll LineCap styles
17.13.3.LineCap styles: LineCap.AnchorMask, LineCap.ArrowAnchor,LineCap.DiamondAnchor, LineCap.FlatLineCap styles: LineCap.AnchorMask, LineCap.ArrowAnchor,LineCap.DiamondAnchor, LineCap.Flat
17.13.4.LineCap.NoAnchor, LineCap.Round, LineCap.RoundAnchor, LineCap.Square, LineCap.SquareAnchor, LineCap.TriangleLineCap.NoAnchor, LineCap.Round, LineCap.RoundAnchor, LineCap.Square, LineCap.SquareAnchor, LineCap.Triangle