Color Dialog Custom colors

  • Thread starter Thread starter J-Rod
  • Start date Start date
J

J-Rod

Hi everyone/anyone,
I am using a button in my app that opens the color dialog, and allows
the user to select a color which changes the backcolor of a label. I
then store the color in my db as a hash value, since i found this to be
the easiest way to store it. However, i want the user to be able to
add custom colors. When they create a custom color within the dialog,
it is not saved there on returning to the dialog. I was thinking about
storing the custom colors in a file, then reading this file into an
array each time to populate the custom colors of the dialog, and then
re-writing the color values to file in order to retrieve them at a
later time. I am having problems finding an example where someone is
saving the custom colors that are created by the user. Am i going about
this the correct way? Any insight would be greatly appreciated!
 
J-Rod said:
Hi everyone/anyone,
I am using a button in my app that opens the color dialog, and allows
the user to select a color which changes the backcolor of a label. I
then store the color in my db as a hash value, since i found this to be
the easiest way to store it. However, i want the user to be able to
add custom colors. When they create a custom color within the dialog,
it is not saved there on returning to the dialog. I was thinking about
storing the custom colors in a file, then reading this file into an
array each time to populate the custom colors of the dialog, and then
re-writing the color values to file in order to retrieve them at a
later time. I am having problems finding an example where someone is
saving the custom colors that are created by the user. Am i going about
this the correct way? Any insight would be greatly appreciated!

Never tried in dotNet but.... here's an extensive (2 line <g>) sample.

ColorDialog.CustomColors Property
http://msdn2.microsoft.com/en-us/library/system.windows.forms.colordialog.customcolors(VS.80).aspx
 
Thanks Ken. I found the same example after i posted and was able to
work something out for my situation.
 
Back
Top