Re: Saving Colors to a db
Fabian Schmied <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
> 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. There's another detail: When you reconstruct a color from its ARGB value, the reconstructed Color is not equal to the original one any longer. E.g.: Color one = Color.Red; Color two = Color.Red; Color three = Color.FromArgb (one.ToArgb); one == two/one.Equals (two) => true one == three/one.Equals (three) => false This might bite you if you need to compare colors loaded from your database to named colors. You can avoid it by either comparing the ARGB values or by using .NET serialization to store Color values in a database, as this should (I guess) include the Color names. Fabian