Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDraw samples of the available dash caps in Visual Basic .NET
DescriptionThis example shows how to draw samples of the available dash caps in Visual Basic .NET.
KeywordsDashCap, dash, dash caps, GetValues, VB.NET
CategoriesGraphics, 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
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated