能生成国际象棋棋盘的vb代码
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