colors in database

  • Thread starter Thread starter Jassim Rahma
  • Start date Start date
J

Jassim Rahma

what's the best way to store and retrieve colors from a database? string or
RGB values or...
 
Jassim said:
what's the best way to store and retrieve colors from a database? string
or RGB values or...
Depends which colours.
If it's going to be only known colours such as Color.Red,
Color.SteelBlue then you could store the name and use Color.FromName to
re-create.
Otherwise you could store the [A]RGB values either separately or
combined and use Color.FromArgb to re-create.
Basically, the _best_ way, is the way that works for you :)

HTH
JB
 
Use the System.Drawing.Color.ToArgb() method to get the integer value of
your color as a single value, and store that in the database. You can then
use the System.Drawing.Color.FromArgb(Int32) method in your app to get the
color from the integer.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

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

Back
Top