c#怎么显示五子棋棋子
c#五子棋棋子怎么随着鼠标点击在窗口上显示 棋子是图片
谢谢大佬
Public Class Form1
Dim n, money As Integer, st As Boolean, a(1) As Image
Private Sub init()
Dim pbox As PictureBox
P1.Image = a(0)
P2.Image = a(0)
P3.Image = a(0)
n = Int(Rnd() * 3 + 1)
pbox = Me.Controls("P" & n)
pbox.Image = a(1)
End Sub
Private Sub init2(ByVal tf As Boolean)
B1.Visible = tf
B2.Visible = tf
B3.Visible = tf
Timer1.Enabled = Not tf
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
init2(False)
Button1.Enabled = False
NumericUpDown1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static i As Integer
i += 1
If i > 10 Then
init2(True)
i = 0
st = True
End If
init()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
a(0) = P1.Image '梅花10
a(1) = P2.Image '红桃K
Randomize()
money = 1000
init()
End Sub
Private Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click, B2.Click, B3.Click
Dim pbox As PictureBox = sender
pbox.Visible = False
If st Then
money += NumericUpDown1.Value * IIf(pbox.Tag = n, 1, -1)
Label2.Text = "赌资:" & money
NumericUpDown1.Maximum = money
If money > 0 Then
NumericUpDown1.Enabled = True
Button1.Enabled = True
Else
Label4.Visible = True
End If
st = False
End If
End Sub
End Class