Colors and masks for the application contained in a file

  • Thread starter Thread starter Lonifasiko
  • Start date Start date
L

Lonifasiko

Hi,

I would need some expert advice around this issue:

My application is divided into 4/5 different areas, therefore, 4/5
different kinds of forms. Each area is going to have a different
bakground color for the form, for the buttons, for the textboxes, the
forecolor of the texts and so on.

I was thinking in using a XML file (or .config file in order to read it
with OpenNETCF.Configuration classes) to mantain this information
correctly structured. I think this is better instead of hardcodiing the
RGB values in each form of the application ;-)

This way, I change the values in this file, I read all values and load
them into memory (static structure accesible along all the
application:NameValueCollection) when starting the application and
finally, each form loads its corresponding values.
What do you think about?

I also would like to have some predefined masks or colors
configuration. This is the idea I have:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="Colors"
type="OpenNETCF.Configuration.NameValueSectionHandler" />
</configSections>
<Colors>
<Fashion>
<Area1>
<FormBackColor>255,255,255</FormBackColor>
<TextForeColor>41,41,56</TextForeColor>
<ButtonActiveBackColor>89,89,230</ButtonActiveBackColor>
</Area1>
<Area2>
<FormBackColor>255,1,255</FormBackColor>
<TextForeColor>41,67,56</TextForeColor>
<ButtonActiveBackColor>89,90,230</ButtonActiveBackColor>
</Area2>
...
</Fashion>
<Classic>
<Area1>
<FormBackColor>0,255,255</FormBackColor>
<TextForeColor>56,56,56</TextForeColor>
<ButtonActiveBackColor>89,230,230</ButtonActiveBackColor>
</Area1>
<Area2>
<FormBackColor>78,1,255</FormBackColor>
<TextForeColor>41,20,44</TextForeColor>
<ButtonActiveBackColor>45,78,30</ButtonActiveBackColor>
</Area2>
...
</Classic>
...
</Colors>
</configuration>

What do you think of this? Too many work maybe? Any other ideas taking
into account performance is very important for me?

Another problem is that I would read the file and would have
"222,56,57" like values. Then I should make a convertion in order to
use Color.FromArgb(int R, int G, int B) method? I'm sure this operation
hits performance very much. Any other way?

Storing in database is another possibility but I think would take much
time.

Thanks very much in advance.
 
Sounds like you are trying to over-complicate it. Unless the forms can
change color during operations via the user/event or something, then
obey the first rule of programming, KISS.


If you still want to do this, then do a search on 'serialisation' or
'serialization'.

Cheers

Chris
 
Colors can be very different because application targets elderly
people, and should be nice if application could be completely
customizable.
I don't want to give backcolor to all my forms with RGB values
"hardcoded".
Sorry for being so full but I don't know what KISS means.

Thanks.
 
Ah, thats a good reason for having differing colors, but will they
'change' once released and installed, I assume not as that would be a
cause for greater confusion. Assuming you don't want the colors
changing once installed and running, I would still fix them at design
time tho, less to go wrong! If not, check out "serialization of
objects", basically, storing and retreiving object properties at
runtime.

KISS - 'Keep It Simple'

Cheers!
Chris
 
Back
Top