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

📄 form1.frm

📁 VB利用image控件进行界面处理的例子。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4095
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7500
   LinkTopic       =   "Form1"
   ScaleHeight     =   4095
   ScaleWidth      =   7500
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   855
      Left            =   3240
      MultiLine       =   -1  'True
      TabIndex        =   4
      Text            =   "Form1.frx":0000
      Top             =   600
      Width           =   3375
   End
   Begin VB.Label LblBtn 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Label1"
      ForeColor       =   &H80000008&
      Height          =   615
      Index           =   3
      Left            =   720
      TabIndex        =   3
      Top             =   2640
      Width           =   2055
   End
   Begin VB.Label LblBtn 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Label1"
      ForeColor       =   &H80000008&
      Height          =   615
      Index           =   2
      Left            =   720
      TabIndex        =   2
      Top             =   1920
      Width           =   2055
   End
   Begin VB.Label LblBtn 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Label1"
      ForeColor       =   &H80000008&
      Height          =   615
      Index           =   1
      Left            =   720
      TabIndex        =   1
      Top             =   1200
      Width           =   2055
   End
   Begin VB.Label LblBtn 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "Label1"
      ForeColor       =   &H80000008&
      Height          =   615
      Index           =   0
      Left            =   720
      TabIndex        =   0
      Top             =   480
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const LBL_BACK_COLOR = &HE0E0E0  '正常时Label控件的背景色
Private Const LBL_WHEN_MOUSE_MOVE = &HC0C0C0  '鼠标移动时Label的背景色
Private Const LBL_WHEN_MOUSE_DOWN = &H808080

Private Sub Form_Load()
bkColor = RGB(235, 235, 235)
Text1.BackColor = bkColor
Dim Count As Integer
For Count = 0 To 3  '请将此出的3换成你的LblBtn数量的个数-1
LblBtn(Count).BackColor = LBL_BACK_COLOR  '初始化LblBtn的背景
Next Count
End Sub

Private Sub LblBtn_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) '当鼠标按在LblBtn上时
LblBtn(Index).BackColor = LBL_WHEN_MOUSE_DOWN    '临时改变LblBtn背景颜色
End Sub
Private Sub LblBtn_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single) '鼠标在LblBtn上面移动时触发该事件
Dim Count As Integer
DoEvents '暂时将系统控制权教给系统
If Button Then Exit Sub '如果按钮被按下就退出该过程
For Count = 0 To 3
If Count <> Index Then '如果按下的不是其它按钮
LblBtn(Index).BackColor = LBL_BACK_COLOR    '将背景设为正常
Else
LblBtn(Index).BackColor = LBL_WHEN_MOUSE_MOVE    '将背景设为鼠标移动的背景
End If
Next Count
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.BorderStyle = 0

Dim Count As Integer
DoEvents
For Count = 0 To 3
LblBtn(Count).BackColor = LBL_BACKCOLOR  '恢复背景
Next Count
End Sub

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DoEvents
Text1.BorderStyle = 1
End Sub

⌨️ 快捷键说明

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