Re: Saving Colors to a db

Ryan Heath <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
Perhaps you should save the KnownColor instead.

private void Button3_Click ( object sender, EventArgs e )
{
  Color col1 = Color.DarkBlue;
  KnownColor knownCol1 = col1.ToKnownColor ( );
  Color col2 = Color.FromKnownColor ( knownCol1 );
  Console.WriteLine ( "{0}, {1}", col1, col2 );
}


HTH
// Ryan

On 7/3/07, Peter Osucha <[email protected]> wrote:
> Thanks, Chris.  The intended audience is somewhat consumer - it is
> another piece of software that goes with a piece of hardware (I always
> seem to work on such products).  I'll just stick with the color number.
> However, since I am using a color dropdown that allows colors to be
> chosen using the Web, System, or palette color selections, it seemed
> like I should try to preserve the user's choice.
>
> Peter
>
> -----Original Message-----
> From: Discussion forum for developers using Windows Forms to build apps
> and controls [mailto:[email protected]] On Behalf Of
> Chris Anderson
> Sent: Monday, July 02, 2007 5:13 PM
> To: [email protected]
> Subject: Re: [DOTNET-WINFORMS] Saving Colors to a db
>
> Web colours are different - they are code as well (HTML) and are encoded
> in English regardless of locale.
>
> However, in programs like Paint, etc where the user is only interested
> in colour, they are only shown the colour itself and the RGB and/or HSV
> values.
>
> You do get some apps that will show you colour names - but I can't think
> of any non-development ones OTTOMH.
> Even Photoshop only shows you numeric values IIRC
>
> So really I suppose it depends on your target audience/use.
> Are you selecting colours for development purposes where the colour name
> is actually hardwired into the language (like .NET HTML, etc) or is it a
> consumer app like Paint or Photoshop where the colours are simply
> colours?
>
> If the former, you can safely give them names as they are the same
> regardless of language, but in the latter I would stick with numbers
> and/or colour cubes, etc (ie a non-locale method of colour selection)
>
> Chris
>
>
> > Hmmm, I never thought of that.  How do the Web Colors, for example,
> > show
> > up on non-english machines?  Perhaps I just shouldn't show the color
> > name, number, etc. at all and should just show the color, eh?
> >
> > Peter
> >
> > -----Original Message-----
> > From: Discussion forum for developers using Windows Forms to build
> apps
> > and controls [mailto:[email protected]] On Behalf Of
> > Chris Anderson
> > Sent: Monday, July 02, 2007 4:20 PM
> > To: [email protected]
> > Subject: Re: [DOTNET-WINFORMS] Saving Colors to a db
> >
> > IMO you shouldn't really be exposing the enumeration names to the
> user.
> > It certainly wouldn't help in a non-English environment ;-)
> >
> > If you needed to though, you could always match it up with the value
> > comparing to the enum values (I'm assuming you are loading a dropdown
> > box or similar anyway, so this lookup wouldn't be too difficult)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.