vb6.0 编码 问题!!!

来源:百度知道 编辑:UC知道 时间:2024/05/26 07:23:43
谁能帮我看看为什么我做的围棋游戏棋子不能放到指定坐标上?
Private zx As Integer
Private zy As Integer
Private zz As Byte
Private qs As Byte

Private Sub pic1_Click()
zz = zz + 1

If zz > 2 Then
zz = zz Mod 2
End If
If zz = 1 Then
qs = 0
End If
If zz = 2 Then
qs = 15
End If
For i = 500 To 7160 Step 370
For j = 700 To 7540 Step 380
Next
Next
pic1.AutoRedraw = True
pic1.FillStyle = 0
pic1.DrawWidth = 1
pic1.FillColor = QBColor(ps)
pic1.Circle (zx, zy), 150
pic1.FillStyle = 0

End Sub

Private Sub pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Y >= 510 Then
If Y <= 7730 Then
If X <= 314 Then
Exit Sub
End If
If X >= 315 Then
If X <= 685 Then
zx = 500
End If
End If

If X >= 6976 Then
If X <= 7345 Then
zx = 7160
End If
End If

Private qs As Long
Private Sub pic1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Private Sub pic1_Click() 完全没有必要
Dim x1 As Single, y1 As Single, i As Integer, j As Integer
i = (X - 350) \ 370 '正负150的误差
j = (Y - 550) \ 380 '正负150的误差
x1 = i * 370 + 500
y1 = j * 380 + 700
'判断大概位置,再计算出交叉点,在误差范围内花点
If X >= x1 - 150 And X <= x1 + 150 And Y >= y1 - 150 And Y <= y1 + 150 Then '正负150的误差
Pic1.FillColor = qs
qs = IIf(qs = vbBlack, vbWhite, vbBlack) '交换棋手(其实是交换颜色)
Pic1.Circle (x1, y1), 70, qs
Pic1.FillStyle = 0
End If
End Sub

Private Sub pic1_Paint()
Pic1.AutoRedraw = True
Pic1.BackColor = vbGreen
qs = vbBlack
Pic1.DrawWidth = 1
For i = 500 To 7160 Step 370
Pic1.Line (i, 700)-(i, 7540) '画竖线,建议用line控件数组,不会被檫掉
Debug.Print i;
Next: Debug.Print
For j = 700 To 7540 Step 380
Debug.Print j;