Form colors right on my computer but not on anyone elses

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
The form is supposed to be mostly tan with bluish text boxes but it ends up being pink and grey. What is going on?
 
The registry is where the colors are read from:

CommunicationLog.RegColors.SetValue("TBsColor", this.colorDialog.Color.ToArgb());

and I use FromArgb() to get them.

So I guess, in answer to your question, I already do that.
 
I don't know, some of the values are set like this:

CommunicationLog.RegColors.SetValue("LogBoxColor", ColorTranslator.FromHtml("#fff8f9d9").ToArgb());
and the values in the registry are saved like this:
0xffebe4cf (4293649615)

Maybe the FromHtml part is a problem, but like I said it is only on other computers and not at all on this one. I have tried win 98 and win xp home and got the same messed up colors. Except I think that the xp have a grey back instead of pink.

I also just tried this, I set the value with:

CommunicationLog.RegColors.SetValue("LogBoxColor", ColorTranslator.FromHtml("#fff8f9d9").Name);
//string value in registry - fff8f9d9

and retrieved it with:

this.LogBox.BackColor=Color.FromName(RegColors.GetValue("LogBoxColor").ToString());

and I got the same exact results.
 
Last edited:
I don't think I do because when I remove just one letter it catches it in my try-catch. And it always works perfect on this computer but not on any other.
 
You are right about them being too long for html colors but they work fine that way and I just tried to use a true html color and the same problem persists. I think it is wierd how it only works on my computer.
 
I tried putting this color in place of my original code: 0000ff. It is the color Blue, not any exotic color like the others.

It saves in the registry like this:
0xff0000ff

and it works perfectly. But I do not want to use normal colors. The user needs to be able to pick any color under the sun. Any ideas as to why only known colors work?
 
I also tried it this way (with the long html color):

CommunicationLog.RegColors.SetValue("FormBackColor", ColorTranslator.FromHtml("#ff0000ff").ToArgb());

and it works perfecly on both computers. But I cannot be restricted to just known colors.

I also, just tried using the colors I chose in VS and not loading from any registry settings at all but the colors are grey now instead of pink.

There has to be something installed on my computer that is not installed on others. Maybe xp professional has some kind of color wheel that win 98 does not.
 
Last edited:
Are you both using 16bit or 32bit color, or is the other machine running only 256 colors or less?

A value with 8 hex digits is fine, by the way. The first pair represents the alpha component, usually FF (255 - or pure white, opaque). If you chop off the first two hex digits the remaining 6 make up the red, green, and blue. If someone is running fewer than 16bit color, a dithering may be applied which means you may not get the exact same color on other machines. Standard colors, including standard Web colors, have a better chance of working but anything but the base 16 colors have no guarantee to work exactly.

I can see no reason why the values would otherwise show up differently on one machine versus another. Have you verified that the colors being read in by the other machine is the same value as the one on your machine?

-Nerseus
 
That was the problem, the other machines were running 256 color and not 16 bit. Thank you very much! The frustration and confusion is now over. Is there a way that I can automatically set the resolution on a computer to 16 bit in my code?
 
How to set (Default) value in registry?

I tried:

SetValue("(Default)", "C:\\WINDOWS\\rundll32.exe shell32.dll,OpenAs_RunDLL %1");
 
Never mind:

SetValue("", "C:\\WINDOWS\\rundll32.exe shell32.dll,OpenAs_RunDLL %1");

Just set the value name to nothing.
 
Back
Top