⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 例9.frm

📁 在VB5环境下开发的VB程序集,窗体控件源代码.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FRM6_5_8 
   Caption         =   "国际象棋"
   ClientHeight    =   3915
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form4"
   ScaleHeight     =   3915
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      Height          =   3375
      Left            =   240
      ScaleHeight     =   3315
      ScaleWidth      =   4155
      TabIndex        =   0
      Top             =   240
      Width           =   4215
      Begin VB.Label Label1 
         Height          =   495
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   495
      End
   End
End
Attribute VB_Name = "FRM6_5_8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
   For m = 1 To 63
      Load Label1(m)                  ' 产生Label1控件数组的其他63个成员
      Label1(m).Visible = True  ' 将Label1控件数组的其他63个成员设置为可见
   Next
End Sub

'设置各控件属性值的代码放在Form_Resize()事件中:
Private Sub Form_Resize()
Picture1.Height = ScaleHeight - 200        ' Picture1的高度略小于窗体高度
Picture1.Width = Picture1.Height              ' 产生方形棋盘
Picture1.Left = ScaleLeft + (ScaleWidth - Picture1.ScaleWidth) / 2   ' 棋盘水平居中
Picture1.Top = ScaleTop + (ScaleHeight - Picture1.ScaleHeight) / 2   ' 棋盘垂直居中
For m = 0 To 7
  For n = 0 To 7
     If m Mod 2 = 0 Then                     ' 为方格设置不同的颜色
        If n Mod 2 = 0 Then
           Label1(8 * m + n).BackColor = &HFFFF&      ' 黄色
        Else
           Label1(8 * m + n).BackColor = &HFF&           ' 红色
        End If
     Else
        If n Mod 2 = 0 Then
           Label1(8 * m + n).BackColor = &HFF&
        Else
           Label1(8 * m + n).BackColor = &HFFFF&
        End If
     End If
     Label1(8 * m + n).Width = Picture1.ScaleWidth / 8       ' 设置方格的宽度
     Label1(8 * m + n).Height = Picture1.ScaleHeight / 8     ' 设置方格的高度
     Label1(8 * m + n).Left = Picture1.ScaleLeft + Picture1.ScaleWidth / 8 * n
 ' 设置方格的左边位置
     Label1(8 * m + n).Top = Picture1.ScaleTop + Picture1.ScaleHeight / 8 * m
' 设置方格的顶端位置
  Next
Next
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -