View Single Post
  #1 (permalink)  
Old 05-25-2006, 08:53 AM
NeedHelp NeedHelp is offline
Programming God
 
Join Date: May 2006
Posts: 527
Credits: 0
Rep Power: 13
NeedHelp is on a distinguished road
Default Proper way to store and retrieve colors from registry

What is the correct way to save and restore colors from the registry? I need to save the forecolor and backcolor and this is currently what I have:

To Save:
Code:
// Softwarekey is a connection to local_user in registry
Color tempColor = control.ForeColor;
softwareKey.SetValue("FontColor",tempColor.ToArgb());
To Restore:
Code:
Color tempColor = Color.FromArgb(Convert.ToInt32(softwareKey.GetValue("FontColor",Color.Gray)));
control.ForeColor = tempColor;
It doesn't seem to be the correct way but it is the only way I could come up with to do this. Any ideas?
__________________
I Need Help
Reply With Quote

Sponsored Links