Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

Label Fore Color Change To Black When GroupBox Is Disabled.

Hi,

I have a groupbox with several control inside.

When I disable the groupbox, all the label fore color is set to black.

I don't want to change the label fore color.

This is also happened to checkbox.

How to solve this problem?

Thank you.
Avatar of Sancler
Sancler

When you Enable/Disable a container control, such as a GroupBox, the .Enabled property of all the controls within that follow the setting.  So when you disable your GroupBox the Labels (and Checkboxes) within it are also disabled.  When controls are disabled, the user is given a visual clue by the appearance changing.  That is "by design", I think.  

If you don't want them to follow that behaviour, one idea would be to put them OVER rather than IN the GroupBox.  So far as Labels are concerned, that should cause no problems: because the user can do little to them anyway.  But do you still want the user to be able to change the state of a CheckBox if it is - even only apparently - part of a disabled GroupBox?

Roger
Avatar of Jorge Paulino
Why don't you loop in all the controls inside the groupbox and disable only the one you like (like checkbox, textbox) ?
Avatar of emi_sastra

ASKER

HI Roger,

I think I should disabled all texbox alone inside the groupbox, so it does not change the labels inside the groupbox.

How to do it?

Thank you.

HI ee_rlee,

Your link is too complicated for me, and for this case I don't need to make custom controls.

Thank you.
Hi jpaulino,

I agree as I just post.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi jpaulino,

Thank you, that is what I need now.