My favourite trick to 'pass through' events in a similar way to what you're asking for is to remember that events are implemented in a similar way to a property - a wrapper around a private delegate. You can override this behaviour using add
and remove
: (using new
to explicitly hide Control.MouseMove)
public new event EventHandler MouseMove {
add { m_Label.MouseMove += value; }
remove { m_Label.MouseMove -= value; }
}
Note that there may be a better way to hide/override the MouseMove event - check how it is implemented by looking at Control in reflector, and see if there's a hook you can override to get the real base MouseMove event. Of course, your event could be named whatever you want if you don't want to hide the base MouseMove event, or even do something like this:
public new event EventHandler MouseMove {
add {
m_Label.MouseMove += value;
base.MouseMove += value;
}
remove {
m_Label.MouseMove -= value;
base.MouseMove -= value;
}
}