private Sub Form_Load()
Dim Count As Integer
Dim LblBtn() As String
For Count = 0 To 3 '请将此出的3换成你的LblBtn数量的个数-1
LblBtn(Count).BackColor = LBL_BACK_COLOR '初始化LblBtn的背景
Next Count
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Count As Integer
DoEvents
For Count = 0 To 3
LblBtn(Count).BackColor = LBL_BACKCOLOR '恢复背景
Next Count
End Sub
Private Sub LblBtn_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
LblBtn(Index).BackColor = LBL_WHEN_MOUSE_DOWN '临时改变LblBtn背景颜色
End Sub
Private Sub LblBtn_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
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 Const LBL_BACK_COLOR = &HE0E0E0 '正常时Label控件的背景色
Private Const LBL_WHEN_MOUSE_MOVE = &HC0C0C0 '鼠标移动时Label的背景色
Private Const LBL_WHEN_MOUSE_DOWN = &H808080 '鼠标按下时Label的背景色
[此贴子已经被作者于2007-4-29 22:21:47编辑过]