Public Class frmBarChart

  Private Sub btnDisplay_Click(ByVal sender As System.Object,
                               ByVal e As System.EventArgs) Handles btnDisplay.Click
    Dim quantity() As Single = {33, 207, 180}
    Dim gr As Graphics = picOutput.CreateGraphics
    'The picture box has width 210 and height 150
    gr.DrawLine(Pens.Black, 40, 110, 210, 110) 'x-axis
    gr.DrawLine(Pens.Black, 40, 110, 40, 0)    'y-axis
    gr.DrawLine(Pens.Black, 35, 60, 45, 60)    'tick mark; 60=110-(100/2)
    gr.DrawString("$100", Me.Font, Brushes.Black, 5, 55)
    Me.Text = "Financing for Public Schools (K - 12)"
    For i As Integer = 0 To quantity.GetUpperBound(0)
      gr.FillRectangle(Brushes.Blue, 60 + i * 40,
                      (110 - quantity(i) / 2), 20, quantity(i) / 2)
    Next
    gr.DrawString("Federal    State    Local", Me.Font,
                   Brushes.Black, 50, 115)
    gr.DrawString("(Expenditures in billions)", Me.Font,
                   Brushes.Black, 50, 130)
  End Sub

End Class
