Pen's Compound Array : Pen « 2D « VB.Net

Pen's Compound Array

Pen's Compound Array
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text

Public Class MainClass

  Shared Sub Main()
     Dim form1 As Form1 = new Form1
  End Sub
End Class

Public Class Form1
  Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

  Public Sub New()

    'This call is required by the Windows Form Designer.

    'Add any initialization after the InitializeComponent() call

  End Sub

  'Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
      If Not (components Is Nothing) Then
      End If
    End If
  End Sub

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(392, 213)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {})
    Me.Name = "Form1"
    Me.Text = "Form1"

  End Sub

#End Region

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  End Sub

  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    Dim G As Graphics = e.Graphics
    Dim P1 As Pen = New Pen(Color.Blue, 10)

    Dim P3 As Pen = New Pen(Color.Blue, 20)
    Dim lines() As Single = {0.0, 0.1, 0.9, 1.0}
    P3.CompoundArray = lines
    G.DrawLine(P3, 20, CInt(Me.Height / 2), Me.Width - 20, CInt(Me.Height / 2))

  End Sub

End Class


Related examples in the same category

1.Transformed PenTransformed Pen
2.Pen Compound Array Demo 1Pen Compound Array Demo 1
3.Draw with Pen Compound ArrayDraw with Pen Compound Array
4.Pen width DemoPen width Demo
5.Draw thick rectangle outline in redDraw thick rectangle outline in red
6.Draw Curve with Different pensDraw Curve with Different pens