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

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.
 
G

Guest

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
 
S

Serpent

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top