Public Class Form1 ' Draw a grid with players names across the left and top. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit Const GAP As Integer = 30 Dim players() As String = {"Archer", "Bezoar", "Chumley", "Deemers", "Everly"} ' Draw the grid. Dim xmin As Integer = 100 Dim ymin As Integer = 75 Dim xmax As Integer = xmin + players.Length * GAP Dim ymax As Integer = ymin + players.Length * GAP ' Draw gridlines. For i As Integer = 0 To players.Length e.Graphics.DrawLine(Pens.Green, xmin, ymin + i * GAP, xmax, ymin + i * GAP) e.Graphics.DrawLine(Pens.Green, xmin + i * GAP, ymin, xmin + i * GAP, ymax) Next i Using the_font As New Font("Comic Sans MS", 15) ' Draw names on the left. For i As Integer = 0 To players.Length - 1 e.Graphics.FillRectangle(Brushes.Green, xmin + i * GAP, ymin + i * GAP, GAP, GAP) e.Graphics.DrawString(players(i), the_font, Brushes.Blue, 4, ymin + i * GAP) Next i ' Draw names across the top. For i As Integer = 0 To players.Length - 1 e.Graphics.RotateTransform(-45) e.Graphics.TranslateTransform(xmin + i * GAP, ymin - GAP \ 2, Drawing2D.MatrixOrder.Append) e.Graphics.DrawString(players(i), the_font, Brushes.Blue, 0, 0) e.Graphics.ResetTransform() Next i End Using End Sub End Class |