i have a System.Windows.Forms.Panel control in a windows application that has many labels and textboxes within the panel. When you call the Panel.Enabled = false command all of the textboxes and labels go gray and become un-editable which is the desired effect. Is there a way to overload the light gray colors when the panel is disabled?
Solution used:
Since the disabled color cant be overiden when disabled the following was used to disable only text boxes and labels on the Panel rather than the blanked Panel.Enabled = false;.
//Loop through the Member info Panel and find all the group boxes
foreach (Control cItem in Panel.Controls)
{
//A group box is found
if (cItem is GroupBox)
{
//Loop through all the group box components
foreach (Control cSubItem in cItem.Controls)
{
//If its a label of text box disable it
if (cSubItem is TextBox || cSubItem is Label)
{
cSubItem.Enabled = false;
}
}
}
}