Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

C#
Posted (edited)

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.

Edited by aewarnick
C#
Posted
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.
C#
Posted

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?

C#
Posted (edited)

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.

Edited by aewarnick
C#
  • *Experts*
Posted

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

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
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?
C#

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...