Changing label color when the mose moves over it.

  • Thread starter Thread starter Timothy Millar
  • Start date Start date
T

Timothy Millar

I know this is a simple question. I want to change the background color of a
label when the mouse moves over it. How would I do this?
 
Labels don't have events, so the easiest way is to put a rectangle control
around the label with a border style of transparent and special effects of
flat. The use the move move event of the rectangle:

Private Sub Box21_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
With Me.Label13
If .BackColor = 16777215 Then
.BackColor = 8454143
Else
.BackColor = 16777215
End If
End With

End Sub
 
Here is the coding I used;

Private Sub Box20_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
With Me.Label19
If .BackColor = 16777215 Then
.BackColor = 8454143
Else
.BackColor = 16777215
End If
End With
End Sub

All that happened was that when the mouse moved over the rectangle the text
in the label shifted from normal to slightly bolded.
 
I am looking at the details of this label and I have;

On Click
On Dbl Click
On Mouse Down
On Mouse Move
On Mouse Up

Are you sure about labels having no events? I am by far an expert on Access.
 
I used the following code and received a result of the text font changing
from normal to a slight bold...nothing else;

Private Sub Label19_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Label19.BackColor = vbRed
End Sub
 
Back
Top