Q:

Disable mouse events on label (while enabled)

I have a "button" comprised of a panel, picturebox and label.
I have disabled the picturebox and label to keep the MouseEnter (and back color) active.
However, the disabled label has the usual faded text - is there a way to keep the label enabled but ignore mouse events as it does when disabled?
Private Sub panelBackup_MouseEnter(sender As Object, e As EventArgs) Handles panelBackupButton.MouseEnter
    Dim btn As Panel = DirectCast(sender, Panel)
    btn.BackColor = Color.Gray
End Sub

Private Sub panelBackup_MouseLeave(sender As Object, e As EventArgs) Handles panelBackupButton.MouseLeave
    Dim btn As Panel = DirectCast(sender, Panel)
    btn.BackColor = Color.LightGray
End Sub

A:

Set the same event also for the label
Private Sub panelBackup_MouseEnter(sender As Object, e As EventArgs) 
                   Handles panelBackupButton.MouseEnter, Label1.MouseEnter 
    Dim btn As Panel = TryCast(sender, Panel) 
    if Not btn Is Nothing then 
        btn.BackColor = Color.Gray 
    else 
        Dim lbl As Label = TryCast(sender, Label)
        lbl.BackColor = Color.Gray 
    end if
End Sub

Private Sub panelBackup_MouseLeave(sender As Object, e As EventArgs) 
                   Handles panelBackupButton.MouseLeave, Label1.MouseLeave 
    Dim btn As Panel = TryCast(sender, Panel) 
    if Not btn Is Nothing then 
        btn.BackColor = Color.LightGray 
    else 
        Dim lbl As Label = TryCast(sender, Label)
        lbl.BackColor = Color.LightGray 
    end if
End Sub 

Also I have removed the DirectCast because you could use directly the panelBackup.BackColor property (otherwise you need to add unnecessary additional logic to differentiate the events fired by the panel or by the label.
EDIT: Seeing your comment I have changed the methods reintroducing the cast, but using TryCast to avoid exceptions when the event is raised by a label.
I should mention that probably is possible to TryCast to a generic Control instead of specific Panel or Label because BackColor is a property inherited from the base class (Control)

