I want to get the background color of all buttons and labels under splitContainer.Panel2. When I try it I discover I not success to run on any control (under Panel2) I try this code:
foreach (Control c in ((Control)splitContainer.Panel2).Controls)
{
if ((c is Button) || (c is Label))
MessageBox.Show("Name: " + c.Name + " Back Color: " + c.BackColor);
}
How can I get all background colors of all labels and buttons under splitContainer.Panel2 ?
EDIT:
- I have some panels in splitcontainer.Panel2 and the buttons and labels are in the panels.
- I get only this meesage: "Name: panel_Right Back Color: Color [Transparent]"
you get the message probably because you have a panel under your
splitContainer.Panel2
and should do: