| Dim cnt As Integer = 0 'ピクチャボックスが何回押されたか Dim n() As Integer = {0, 50, 100, 150, 200, 250, 300, 350, 400} '描写等に必要な配列、各線の値 Dim gridnum(7, 7) As Integer 'どこのマスが選択されたかをこの配列に代入 Dim whitenum, blacknum, tortal As Integer '黒と白がそれぞれいくつあるか |
| ボタンクリック時のイベント |
| Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = PictureBox1.CreateGraphics Dim num As Integer = 3 PictureBox1.BackColor = Color.LawnGreen Dim numx As Integer = 4 For n As Integer = 0 To 8 'ラインの描画 g.DrawLine(Pens.Black, 50 * n, 0, 50 * n, 400) Next For n As Integer = 0 To 8 'ラインの描画 g.DrawLine(Pens.Black, 0, 50 * n, 400, 50 * n) Next Do '初期配置石の描画 g.FillEllipse(Brushes.Black, n(num), n(num), n(1), n(1)) num += 1 Loop While num = 4 num -= 2 Do '初期配置石の描画 g.FillEllipse(Brushes.White, n(num), n(numx), n(1), n(1)) num += 1 numx -= 1 Loop While num = 4 End Sub |

| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = PictureBox1.CreateGraphics For n As Integer = 0 To 8 g.DrawLine(Pens.Black, 0, 50 * n, 400, 50 * n) Next For n As Integer = 0 To 8 g.DrawLine(Pens.Black, 50 * n, 0, 50 * n, 400) Next End Sub |