能生成国际象棋棋盘的vb代码
1个回答
展开全部
Function DrawBoard() As Boolean
'棋盘为8x8
Dim i As Integer, j As Integer
Dim nSize As Integer '小方块大小,单位:像素
Dim b As Boolean '悔旦标记变量,用碧宏扰于形绝慧成不同颜色的方块
nSize = 120
For i = 0 To 7
For j = 0 To 7
If b Then
pic1.Line (nSize * i, nSize * j)-(nSize * (i + 1), nSize * (j + 1)), &H884433, BF
Else
pic1.Line (nSize * i, nSize * j)-(nSize * (i + 1), nSize * (j + 1)), &HA0A0A0, BF
End If
b = Not b
Next j
b = Not b
Next i
DrawBoard = True
End Function
'棋盘为8x8
Dim i As Integer, j As Integer
Dim nSize As Integer '小方块大小,单位:像素
Dim b As Boolean '悔旦标记变量,用碧宏扰于形绝慧成不同颜色的方块
nSize = 120
For i = 0 To 7
For j = 0 To 7
If b Then
pic1.Line (nSize * i, nSize * j)-(nSize * (i + 1), nSize * (j + 1)), &H884433, BF
Else
pic1.Line (nSize * i, nSize * j)-(nSize * (i + 1), nSize * (j + 1)), &HA0A0A0, BF
End If
b = Not b
Next j
b = Not b
Next i
DrawBoard = True
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询