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
 
 
 
 
 
TitleDisplay join styles in Visual Basic .NET
DescriptionThis example shows how to display join styles in Visual Basic .NET.
Keywordsjoin styles, LineJoin, line, drawing, graphics, VB.NET
CategoriesGraphics, VB.NET
 
The form's Paint event handler makes an array of Points that defines a zigzag. It then draws the zigzag in various join styles, translating the drawing coordinates down each time.
 
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
    System.Windows.Forms.PaintEventArgs) Handles _
    MyBase.Paint
    Dim pts() As Point = {New Point(20, 20), New Point(120, _
        20), New Point(50, 50), New Point(180, 20)}
    Dim the_pen As New Pen(Color.Blue, 10)

    the_pen.LineJoin = Drawing2D.LineJoin.Bevel
    e.Graphics.DrawLines(the_pen, pts)
    e.Graphics.DrawString("Bevel", Me.Font, Brushes.Black, _
        200, 20)

    e.Graphics.TranslateTransform(0, 60)
    the_pen.LineJoin = Drawing2D.LineJoin.Miter
    e.Graphics.DrawLines(the_pen, pts)
    e.Graphics.DrawString("Miter", Me.Font, Brushes.Black, _
        200, 20)

    e.Graphics.TranslateTransform(0, 60)
    the_pen.LineJoin = Drawing2D.LineJoin.MiterClipped
    e.Graphics.DrawLines(the_pen, pts)
    e.Graphics.DrawString("MiterClipped", Me.Font, _
        Brushes.Black, 200, 20)

    e.Graphics.TranslateTransform(0, 60)
    the_pen.LineJoin = Drawing2D.LineJoin.Round
    e.Graphics.DrawLines(the_pen, pts)
    e.Graphics.DrawString("Round", Me.Font, Brushes.Black, _
        200, 20)
End Sub
 
Note that the MiterClipped style uses a miter style if the angle between two lines isn't too small but switches to a bevel style of the angle is very small.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated