How to make all controls disable foreColor and BackColor same as ReadOnly = true?

  • Thread starter Thread starter ABC
  • Start date Start date
A

ABC

How to make all controls disable foreColor and BackColor same as ReadOnly =
true?

As the disable textbox or another controls color is so hard to read, I want
a good method to set all control same as ReadOnly TextBox control's Colors.

There are many program code to modify if I modify from "xxx.enabled = false"
to "xxx.ReadOnly = true". It also spend more time to retest program. Help
Help Help.
 
You might surround your controls with a groupbox and then set the readonly
property of the groupbox to true which would make all controls inside the
groupbox read-only as well.

good luck
 
well, if u really need a generic method, you can do the following.
1) add reference of System.Reflection
2) and in your code, where you are performing
initialization add.
Assembly l_oAssembly =
Assembly.GetExecutingAssembly();
Types[] l_oTypes = l_oAssembly.GetTypes();

This array of Types is a collection of all the
propertise of your Running application. Select the appropriate type and
call "GetPropertise()" function to get the propertyInfo array. From
there, Set any value you like by calling "SetValue" function. It is by
far the best and most general method to change propertises.
 
Back
Top