首页上一页 1 下一页尾页 1 条记录 1/1页
实战突击:Visual Basic第一章五子棋坐标问题,求高手赐教!
发表在VB答疑区
2016-09-27
是否精华
是
否
版块置顶:
是
否
Sub HuaQi()
Dim X, Y
X = 3: Y = 2
For i = 1 To 15
For j = 1 To 15
Select Case QiPan(i, j)
Case 1
BitBlt Form1.Picture1.hDC, X, Y, 20, 20, Form1.Picture2.hDC, 0, 0, srccopy
Case 2
BitBlt Form1.Picture1.hDC, X, Y, 20, 20, Form1.Picture3.hDC, 0, 0, srccopy
End Select
Y = Y + 20
Next j
Y = 2
X = X + 21
Next i
Form1.Picture1.Refresh
End Sub
以上X=3,Y=2 是怎么确定的?怎么算它的初始坐标
Sub GetMyData(Size)
Dim s, sx, sy, a
Dim mydata As String
Form1.Winsock1.GetData mydata, vbString
Select Case Mid(mydata, 1, 1)
Case "1"
If bol = False Then bol = True
If Player = 1 Then s = 2 Else s = 1
sx = Asc(Mid(mydata, 2, 1))
sy = Asc(Mid(mydata, 3, 1))
QiPan(sx, sy) = s
HuaQi
a = GameOver(s)
Form1.Picture1.Enabled = True
If a = s Then
Form1.Picture1.Enabled = False
Lost(Player) = Lost(Player) + 1
Win(s) = Win(s) + 1
Form1.Label1(2).Caption = "战绩:" + Str(Win(1)) + "胜" + Str(Lost(1)) + "败"
Form1.Label1(4).Caption = "战绩:" + Str(Win(2)) + "胜" + Str(Lost(2)) + "败"
MsgBox "你输了,继续努力哦", vbOKOnly, "胜负信息"
End If
Case "2"
If Player = 1 Then
Form1.Label1(3).Caption = Mid(mydata, 2, Size - 1)
Send "2" + Form1.Label1(1).Caption
Else
Form1.Label1(1).Caption = Mid(mydata, 2, Size - 1)
End If
Case "3"
ResetGame
Case "4"
Form1.Label2.Caption = "对方断开链接"
ResetGame
Form1.Picture1.Enabled = False
Form1.Cmd1(0).Enabled = False
Form1.Cmd1(2).Enabled = False
If Form1.Winsock1.State = 7 Then Form1.Winsock1.Close
Form1.Winsock1.Listen
Case "5"
Form1.Text1.Text = Form1.Text1.Text & Mid(mydata, 2, Size - 1)
Case Else
End Select
End Sub
上面程序的 "bol"是指什么?
Dim X, Y
X = 3: Y = 2
For i = 1 To 15
For j = 1 To 15
Select Case QiPan(i, j)
Case 1
BitBlt Form1.Picture1.hDC, X, Y, 20, 20, Form1.Picture2.hDC, 0, 0, srccopy
Case 2
BitBlt Form1.Picture1.hDC, X, Y, 20, 20, Form1.Picture3.hDC, 0, 0, srccopy
End Select
Y = Y + 20
Next j
Y = 2
X = X + 21
Next i
Form1.Picture1.Refresh
End Sub
以上X=3,Y=2 是怎么确定的?怎么算它的初始坐标
Sub GetMyData(Size)
Dim s, sx, sy, a
Dim mydata As String
Form1.Winsock1.GetData mydata, vbString
Select Case Mid(mydata, 1, 1)
Case "1"
If bol = False Then bol = True
If Player = 1 Then s = 2 Else s = 1
sx = Asc(Mid(mydata, 2, 1))
sy = Asc(Mid(mydata, 3, 1))
QiPan(sx, sy) = s
HuaQi
a = GameOver(s)
Form1.Picture1.Enabled = True
If a = s Then
Form1.Picture1.Enabled = False
Lost(Player) = Lost(Player) + 1
Win(s) = Win(s) + 1
Form1.Label1(2).Caption = "战绩:" + Str(Win(1)) + "胜" + Str(Lost(1)) + "败"
Form1.Label1(4).Caption = "战绩:" + Str(Win(2)) + "胜" + Str(Lost(2)) + "败"
MsgBox "你输了,继续努力哦", vbOKOnly, "胜负信息"
End If
Case "2"
If Player = 1 Then
Form1.Label1(3).Caption = Mid(mydata, 2, Size - 1)
Send "2" + Form1.Label1(1).Caption
Else
Form1.Label1(1).Caption = Mid(mydata, 2, Size - 1)
End If
Case "3"
ResetGame
Case "4"
Form1.Label2.Caption = "对方断开链接"
ResetGame
Form1.Picture1.Enabled = False
Form1.Cmd1(0).Enabled = False
Form1.Cmd1(2).Enabled = False
If Form1.Winsock1.State = 7 Then Form1.Winsock1.Close
Form1.Winsock1.Listen
Case "5"
Form1.Text1.Text = Form1.Text1.Text & Mid(mydata, 2, Size - 1)
Case Else
End Select
End Sub
上面程序的 "bol"是指什么?