| 
            
           | 
          
            | 
          
          
          
          
            
              
              
                
                  | Title | Draw samples of the available dash caps in Visual Basic .NET |  
                  | Description | This example shows how to draw samples of the available dash caps in Visual Basic .NET. |  
                  | Keywords | DashCap, dash, dash caps, GetValues, VB.NET |  
                  | Categories | Graphics, VB.NET |  
                 
               |  
              
               
  |  
              | 
DashCap values determine how the ends of the dashes are drawn in a dashed line. Then can be square, rounded, or pointed.
 
The following code loops through the values defined by the DashCap enumeration and displays examples of each.
                |  
              
               
  |  
              
                
                  Private Sub Form1_Paint(...) Handles MyBase.Paint
    Dim y As Integer = 10
    For Each dash_cap As DashCap In _
        DashCap.GetValues(GetType(DashCap))
        e.Graphics.DrawString(dash_cap.ToString(), Me.Font, _
            Brushes.Black, 10, y)
        y += 5
        Dim thick_pen As New Pen(Color.Blue, 11)
        thick_pen.DashStyle = DashStyle.Dash
        thick_pen.DashCap = dash_cap
        e.Graphics.DrawLine(thick_pen, 100, y, 250, y)
        thick_pen.Dispose()
        y += 30
    Next dash_cap
End Sub
               |  
              
              
              
              |   |  
               
 |  
              |   |  
              
           |  
          
          
          
          
             
           |