关于VB的这些程序 哪个大神帮我翻译下啊 谢谢了~~~!这个是关于那个五子棋的程序~~ 5

Dimr,g,b,n,m,j,k,p,qAsIntegerDimW(19,19)AsIntegerPrivateSubCommand1_Click()DimiAsInte... Dim r, g, b, n, m, j, k, p, q As Integer
Dim W(19, 19) As Integer
Private Sub Command1_Click()
Dim i As Integer
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0)
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End Sub
Private Sub Command2_Click()
choice = MsgBox("确定重新开始?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Form1.Cls
r = 255
g = 255
b = 255
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0)
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End If
End Sub

Private Sub Command3_Click()
choice = MsgBox("确定退出游戏?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Unload Me
End If
End Sub

Private Sub Form_Load()
Form1.Cls
r = 255
g = 255
b = 255
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
r = Abs(r - 255)
g = Abs(g - 255)
b = Abs(b - 255)
Form1.FillStyle = 4
Form1.FillColor = RGB(r, g, b)
For m = 1 To 19
If X >= 250 * (2 * m - 1) And X <= 250 * (2 * m + 1) Then
For n = 1 To 19
If Y >= 250 * (2 * n - 1) And Y <= 250 * (2 * n + 1) Then
Form1.Circle (500 * m, 500 * n), 250
If Form1.FillColor = RGB(0, 0, 0) Then
W(m - 1, n - 1) = 0
Else
W(m - 1, n - 1) = 1
End If
End If
Next n
End If
展开
 我来答
chinaboyzyq
2012-12-31 · TA获得超过1.3万个赞
知道大有可为答主
回答量:1.3万
采纳率:89%
帮助的人:3299万
展开全部
Dim r, g, b, n, m, j, k, p, q As Integer
Dim W(19, 19) As Integer
Private Sub Command1_Click() '画棋盘
Dim i As Integer
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2 '区分有无棋子,是黑棋还是白棋等。
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0) '画棋盘的线
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50 '画棋盘上的圆点
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End Sub
Private Sub Command2_Click() '重画棋盘
choice = MsgBox("确定重新开始?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Form1.Cls
r = 255
g = 255
b = 255
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0)
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End If
End Sub

Private Sub Command3_Click() '退出程序
choice = MsgBox("确定退出游戏?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Unload Me
End If
End Sub

Private Sub Form_Load() '初始化界面和色彩参数
Form1.Cls
r = 255
g = 255
b = 255
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)'下棋
r = Abs(r - 255)
g = Abs(g - 255)
b = Abs(b - 255)
Form1.FillStyle = 4
Form1.FillColor = RGB(r, g, b)
For m = 1 To 19
If X >= 250 * (2 * m - 1) And X <= 250 * (2 * m + 1) Then
For n = 1 To 19
If Y >= 250 * (2 * n - 1) And Y <= 250 * (2 * n + 1) Then
Form1.Circle (500 * m, 500 * n), 250
If Form1.FillColor = RGB(0, 0, 0) Then
W(m - 1, n - 1) = 0
Else
W(m - 1, n - 1) = 1
End If
End If
Next n
End If
Next

End Sub
暖空方6047
2013-01-05 · TA获得超过102个赞
知道答主
回答量:151
采纳率:0%
帮助的人:62.6万
展开全部
我告诉你 Dim r, g, b, n, m, j, k, p, q As Integer
Dim W(19, 19) As Integer
Private Sub Command1_Click() '画棋盘
Dim i As Integer
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2 '区分有无棋子,是黑棋还是白棋等。
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0) '画棋盘的线
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50 '画棋盘上的圆点
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End Sub
Private Sub Command2_Click() '重画棋盘
choice = MsgBox("确定重新开始?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Form1.Cls
r = 255
g = 255
b = 255
For p = 0 To 18
For q = 0 To 18
W(p, q) = 2
Next q
Next p
For i = 0 To 18
Form1.Line (500, 500 + 500 * i)-Step(9000, 0)
Form1.Line (500 + 500 * i, 500)-Step(0, 9000)
Next i
Form1.Circle (5000, 5000), 50
Form1.Circle (2000, 5000), 50
Form1.Circle (5000, 2000), 50
Form1.Circle (5000, 8000), 50
Form1.Circle (8000, 5000), 50
Form1.Circle (2000, 2000), 50
Form1.Circle (8000, 2000), 50
Form1.Circle (2000, 8000), 50
Form1.Circle (8000, 8000), 50
End If
End Sub

Private Sub Command3_Click() '退出程序
choice = MsgBox("确定退出游戏?", vbOKCancel + vbQuestion + vbDefaultButton1, "提示")
If choice = vbOK Then
Unload Me
End If
End Sub

Private Sub Form_Load() '初始化界面和色彩参数
Form1.Cls
r = 255
g = 255
b = 255
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)'下棋
r = Abs(r - 255)
g = Abs(g - 255)
b = Abs(b - 255)
Form1.FillStyle = 4
Form1.FillColor = RGB(r, g, b)
For m = 1 To 19
If X >= 250 * (2 * m - 1) And X <= 250 * (2 * m + 1) Then
For n = 1 To 19
If Y >= 250 * (2 * n - 1) And Y <= 250 * (2 * n + 1) Then
Form1.Circle (500 * m, 500 * n), 250
If Form1.FillColor = RGB(0, 0, 0) Then
W(m - 1, n - 1) = 0
Else
W(m - 1, n - 1) = 1
End If
End If
Next n
End If
Next

End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式