VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "控件数组"
   ClientHeight    =   3105
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3750
   FillColor       =   &H00FFFFFF&
   LinkTopic       =   "Form1"
   ScaleHeight     =   3105
   ScaleWidth      =   3750
   StartUpPosition =   3  '窗口缺省
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Visible         =   0   'False
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
    Dim mtop As Integer, mleft As Integer, i As Integer, j As Integer
    mtop = 0                                ' 棋盘顶边初值
    For i = 1 To 8
        mleft = 50                          ' 棋盘左边位置
        For j = 1 To 8
          k = (i - 1) * 8 + j
          Load Label1(k)
          Label1(k).BackColor = IIf((i + j) Mod 2 = 0, QBColor(0), QBColor(15))
          Label1(k).Visible = True
          Label1(k).Top = mtop
          Label1(k).Left = mleft
          mleft = mleft + Label1(0).Width
        Next j
        mtop = mtop + Label1(0).Height
    Next i
End Sub
'单击棋格,
Private Sub Label1_Click(Index As Integer)
  Dim tag As Boolean
  Label1(Index) = Index
 For i = 1 To 8
   For j = 1 To 8
    k = (i - 1) * 8 + j
  If Label1(k).BackColor = &H0& Then
    Label1(k).BackColor = &HFFFFFF
  Else
    Label1(k).BackColor = &H0&
 End If
 Next j
 Next i
End Sub

