Adding an event to an contained control means that if you want to add another control to the panel, you also need to go through this exercise.
Adding an event to the parent control means that as soon as you want to use the panel elsewhere, you must do the same for the new parent. And when the panel requirements change, you must remember that you need to perform processing from the parent control.
Everything is potentially randomly a little further down the line.
I would be inclined to put some check of coordinates in the event of leaving the mouse for the panel and only reset the color of the panel if the mouse really went beyond the panel.
Thus, your code for processing the panel remains only on the panel in question.
source share