Gruppe
Dialog
Bereich
Maus
Thema
Farbe bei Mausberührung wechseln
Problem
Wie kann ich die Hintergrundfarbe eines Labels in einer UserForm für den Zeitraum verändern, für den sich die Maus über das Label bewegt?
Lösung
Geben Sie den nachfolgenden Code in das Klassenmodul der UserForm ein.
ClassModule: frmColors
Private Sub lblcolor_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
lblColor.BackColor = RGB(125, 250, 250)
End Sub
Private Sub cmdContinue_Click()
Unload Me
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
lblColor.BackColor = RGB(250, 125, 250)
End Sub
StandardModule: basMain
Sub CallForm()
frmColors.Show
End Sub