Mega Code Archive

 
Categories / VB.Net Tutorial / 2D Graphics
 

Adjustable RowCap

Imports System.Drawing Imports System.Drawing.Drawing2D Imports System.Windows.Forms public class AdjustableRowCap    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 cap1 As New AdjustableArrowCap(1, 1, False)         Dim cap2 As New AdjustableArrowCap(2, 1)         cap1.BaseCap = LineCap.Round         cap1.BaseInset = 5         cap1.StrokeJoin = LineJoin.Bevel         cap2.WidthScale = 3         cap2.BaseCap = LineCap.Square         cap2.Height = 1         Dim blackPen As New Pen(Color.Black, 15)         blackPen.CustomStartCap = cap1         blackPen.CustomEndCap = cap2         g.DrawLine(blackPen, 20, 50, 200, 50)         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