Gruppe
Ereignis
Bereich
MouseMove
Thema
Schaltflächefarbe beim Überfahren mit der Maus ändern
Problem
Beim Überfahren der Schaltflächen mit der Maus sollen Ampelfarben angezeigt werden.
Lösung
Geben Sie den Ereigniscode in das Klassenmodul des Arbeitsblattes ein.
ClassModule: Tabelle1
Private Sub CommandButton1_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
CommandButton1.BackColor = vbRed
CommandButton2.BackColor = vbWhite
CommandButton3.BackColor = vbWhite
End Sub
Private Sub CommandButton2_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
CommandButton1.BackColor = vbWhite
CommandButton2.BackColor = vbYellow
CommandButton3.BackColor = vbWhite
End Sub
Private Sub CommandButton3_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
CommandButton1.BackColor = vbWhite
CommandButton2.BackColor = vbWhite
CommandButton3.BackColor = vbGreen
End Sub
Private Sub Label1_MouseMove( _
ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal X As Single, _
ByVal Y As Single)
CommandButton1.BackColor = vbWhite
CommandButton2.BackColor = vbWhite
CommandButton3.BackColor = vbWhite
End Sub
StandardModule: Modul1
Sub Dummy()
End Sub