Public Class Form1
  Inherits System.Windows.Forms.Form
  Private triangles As ArrayList
  Private Sub init()
    'Utwórz listę trójkątów do narysowania
    triangles = New ArrayList()
    Dim t1 As New StdTriangle( _
        New Point(10, 10), New Point(150, 50), _
         New Point(100, 75))
    Dim t2 As New IsocelesTriangle( _
        New Point(150, 100), New Point(240, 40), _
         New Point(175, 150))
    triangles.Add(t1)
    triangles.Add(t2)
  End Sub

#Region " Windows Form Designer generated code "

  Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call
    init()
  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
        components.Dispose()
      End If
    End If
    MyBase.Dispose(disposing)
  End Sub
  Friend WithEvents Pic As System.Windows.Forms.PictureBox

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

  '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.Pic = New System.Windows.Forms.PictureBox()
    Me.SuspendLayout()
    '
    'Pic
    '
    Me.Pic.BackColor = System.Drawing.SystemColors.ActiveCaptionText
    Me.Pic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.Pic.Location = New System.Drawing.Point(16, 24)
    Me.Pic.Name = "Pic"
    Me.Pic.Size = New System.Drawing.Size(256, 192)
    Me.Pic.TabIndex = 0
    Me.Pic.TabStop = False
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Pic})
    Me.Name = "Form1"
    Me.Text = "Triangle template demo"
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub Pic_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Pic.Paint
    Dim i As Integer
    Dim g As Graphics = e.Graphics
    For i = 0 To triangles.Count - 1
      Dim t As Triangle = CType(triangles(i), Triangle)
      t.draw(g)
    Next
  End Sub

End Class
