Private Sub Command1_Click()
s = 1
t = 1
For i = 2 To 64
t = t + t
s = s + t
Next i
Print "64个格子全部放完尺正麦子陵做悔胡喊,"
Print "总共为"s"粒"
End Sub
贴保存棋局和读取棋局部分的,你先看看:Rem 读取棋局
Private Sub mnuRead_Click()
Dim s As String, i As Integer, t
If Dir(App.Path &"\cchess.che") = ""和指 Then MsgBox "没有棋局文件可以读入!请先保存棋局!", , "中国象棋": Exit Sub
Open App.Path &"\cchess.che" For Input As #1
Input #1, s
Close #1
s = Replace(s, vbCrLf, "")
s = Trim(s)
t = Split(s, " ")
If UBound(t) <>89 Then MsgBox "棋局文件已遭到破坏!请重新保存唤稿配棋局!", , "中国象棋": Exit Sub
For i = 0 To 89
a(i) = Val(t(i))
Next
MsgBox "棋局文件已成功读入!敬消", , "中国象棋"
End Sub
Rem 保存棋局
Private Sub mnuSave_Click()
Dim s As String, i As Integer
s = ""
For i = 0 To 89
s = s &" " &a(i)
Next
s = Trim(s)
Open App.Path &"\cchess.che" For Output As #1
Print #1, s
Close #1
MsgBox "当前棋局已成功保存!", , "中国象棋"
End Sub
记得以前上学的时候做过的,个人推荐:先用线条画出棋盘,然后在棋盘的碰亮碧90的点都画好棋子(可以用image控件画圆,lable控件显示棋子内容),并编成10*9的二维数组,利用控件image的visible属性控制是否显示,控件lable控笑举制显示的内容。
个人键模认为这个应该比利用坐标让控件移动的方法简单
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)