PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Storing value of a MigraDoc.DocumentObjectModel.Color in...
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2035
Page 1 of 1

Author:  francisd [ Tue May 29, 2012 9:54 pm ]
Post subject:  Storing value of a MigraDoc.DocumentObjectModel.Color in...

Hi all,

First off, I want to thank the creators of PDFSharp for making such a great tool :)

So my question is: Has anyone ever been able to store a color value setting (ie: Colors.SlateBlue) as a custom type in an app.config file ?

I tried asking in C# specific forums, but to no avail. So I thought I'd ask here. Kindly just tell me if this is not supported.

Thank you!

Author:  Thomas Hoevel [ Wed May 30, 2012 8:34 am ]
Post subject:  Re: Storing value of a MigraDoc.DocumentObjectModel.Color in

Hi, Francis,

I never tried it.

If you store the string "Slateblue" in the config file, use "public static Color Parse(string color)" (Color class) to retrieve the color.
If you store an uint32 (e.g. "0xFF6A5ACD" for Slateblue), use "public Color(uint argb)" to retrieve the color.

Parse will also handle the string "0xFF6A5ACD".

This is just a "haven't tried but should work" advice.
Where do you see a problem storing colors in config files?

Author:  francisd [ Wed May 30, 2012 1:38 pm ]
Post subject:  Re: Storing value of a MigraDoc.DocumentObjectModel.Color in

Thomas Hoevel wrote:
Hi, Francis,

I never tried it.

If you store the string "Slateblue" in the config file, use "public static Color Parse(string color)" (Color class) to retrieve the color.
If you store an uint32 (e.g. "0xFF6A5ACD" for Slateblue), use "public Color(uint argb)" to retrieve the color.

Parse will also handle the string "0xFF6A5ACD".

This is just a "haven't tried but should work" advice.
Where do you see a problem storing colors in config files?


Holy crap, that really solves it all. Then I only need to store the color settings as string and use the Color.Parse() function. You guys really thought about everything :)

Thanks.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/