Geekpedia Forums Logo

Fonts and colors with the registry

by Ryan Turney on Wednesday, May 16th - 11:13 PM



Hello, I am nearing completion on my current project but I am stumped on reading and writing to the registry. I am using Francesco Natali's ModifyRegistry.cs from Code Project to help me do this. I have been successful in reading and writing int and string values but I am stuck on Fonts and Colors.

My main question is: What would I convert Fonts and Colors to, to write them and then read them to/from the registry? The Font object automatically converts to a string when writing it to the registry, but if I try and convert it to a string to read it, it just spits errors back at me. Any Ideas?

Thanks in advance for any help.

Hi Ryan.

It is likely that you are using the wrong approach to what you are trying to do. If you are really looking to store the color and font of a certain string in the registry, you would have to store these as a string (font name, color in hex). If you're rendering these as HTML, you'd just store them as HTML.
Either way, it's not recommended that you overload the registry with such values. but rather use XML or a similar format.