关于VB 五子棋 悔棋。。。代码注释!请高手帮忙注解,越详细越好!

2024-12-27 01:07:01
推荐回答(2个)
回答1:

Public Function DoBack() As Boolean 悔棋的定义
If Not Playing Or Round = 1 Then Exit Function 判断是否是第一步 是则退出
Dim Row As Integer, Col As Integer 定义ROW COL
Round = Round - 1 步数减一
If Player = BlackStone Then 判断是黑棋还是白棋 选择
Player = WhiteStone
Else
Player = BlackStone
End If
Row = StonePut(Round).Row 回到上一步的ROW
Col = StonePut(Round).Col 回到上一步的COL
Stones(Row, Col) = NoStone 去掉上一步
DrawBack Row, Col 还原原始状态
ShowInfo
End Function
Public Sub DrawBack(Row As Integer, Col As Integer)
Dim X As Long, Y As Long
X = Row * CellSize + Border - StoneSize \ 2
Y = Col * CellSize + Border - StoneSize \ 2
Me.PaintPicture Me.Picture, X, Y, , , X, Y, StoneSize, StoneSize, vbSrcCopy
End Sub

回答2:

rewrefggdddg