Public Class GdPic
  Inherits System.Windows.Forms.PictureBox
  Private gden As Garden
  Private loaded As Boolean
  Private br As SolidBrush
  '-----
  Private Sub init()
    br = New SolidBrush(Color.Gray)
  End Sub
  '-----
  Public Sub setGarden(ByVal gd As Garden)
    gden = gd
    gden.clear()
    Refresh()
    loaded = True
  End Sub
  '-----
  Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
    Dim g As Graphics = pe.Graphics
    'Narysuj koło 
    g.FillEllipse(br, 5, 5, 100, 100)
    If loaded Then
      'Odrysuj ogród
      gden.draw(g)
    End If
  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

  'UserControl 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

  '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()
    components = New System.ComponentModel.Container()
  End Sub

#End Region

End Class
