I have some Panel
's and each Panel
has a PictureBox
and a Label
in it.
public static void redPanel(Panel panel1)
{
panel1.MouseEnter += new EventHandler((o, a) => panel1.BackColor = Color.Brown);
panel1.MouseDown += new MouseEventHandler((o, a) => panel1.BackColor = Color.DarkRed);
panel1.MouseUp += new MouseEventHandler((o, a) => panel1.BackColor = Color.Firebrick);
panel1.MouseLeave += new EventHandler((o, a) => panel1.BackColor = Color.Firebrick);
}
I made this code so the panel reacts to mouse hover and click ... but if I hover the Label
or the PictureBox
the Panel
reverts to its original color. I want that the Label
and the PictureBox
to act exactly like the Panel
(ex: If I click the Label
I want that to count as a click on the Panel
).
I want some code ... like SourceControl
or something for the function from top to manage its own Label
and PicureBox
.
P.S: I tried to make another functions for Label
and PictureBox
but each Panel
has different color so It means that I need to have about 23 lines of code just for labels ...