Re: Saving Colors to a db
Peter Osucha <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <[email protected]> |
Fabian, What do you mean by 'using .NET serialization to store color values in a database'? Peter -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:[email protected]] On Behalf Of Fabian Schmied Sent: Tuesday, July 03, 2007 8:56 AM To: [email protected] Subject: Re: [DOTNET-WINFORMS] Saving Colors to a db > 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