Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C# : Persisting Font information

  • 03-12-2004 11:36am
    #1
    Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭


    Anyone able to give me a quick pointed on how to accomplish this?

    Initially, I thought that I could just persist myFont.ToString(), but the Font object doesn't have a constructor which takes this string representation.

    So then I saw the FontConverter class, but after a quick perusal of it, my suffering-from-lack-of-sleep brain is telling me that I still don't get it. I can see how to convert *from* a font, but not how to take that info and go back to one.

    I'm sure its probably bloody simple....but I'm just having one of those days where things are just not making sense.

    jc


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    As per usuak...seconds after looking for help, you find what you're looking for in the first place.
            TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font));
            // to string
            string s = tc.ConvertToString(f);
    
            // back to Font
            Font f2 = (Font) tc.ConvertFromString(s);
    

    That will do nicely.


  • Registered Users, Registered Users 2 Posts: 7,581 ✭✭✭uberwolf


    ur welcome ;) hate it when that happens


Advertisement