Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Using the_pen As New Pen(Color.Blue) Dim y As Integer = 10 ' Standard dot. the_pen.DashStyle = Drawing2D.DashStyle.Dot e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 ' Standard dash. the_pen.DashStyle = Drawing2D.DashStyle.Dash e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 ' Thin with long dashes. the_pen.DashStyle = Drawing2D.DashStyle.Custom the_pen.DashPattern = New Single() {10, 2} e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 ' Thick with the same absolute dash lengths. the_pen.Width = 5 the_pen.DashStyle = Drawing2D.DashStyle.Custom the_pen.DashPattern = New Single() {10 / 5, 2 / 5} e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 ' Thick with the same relative dash lengths. the_pen.Width = 5 the_pen.DashStyle = Drawing2D.DashStyle.Custom the_pen.DashPattern = New Single() {10, 2} e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 ' Thick Dash Dash Dot Dot. the_pen.Width = 5 the_pen.DashStyle = Drawing2D.DashStyle.Custom the_pen.DashPattern = New Single() {5, 2, 5, 2, 2, 2, 2, 2} e.Graphics.DrawLine(the_pen, 10, y, 250, y) y += 15 End Using End Sub |