Updating the font dialog box

csharp United States
  • 19 years ago

    I'm attempting to update the font dialog box and I'm successful except for updating the style.  I'm using a type converter to convert a string to a font object.  Here is the code:


    dlgFont.Font = (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString("Arial, 48 pt");


    This works.  When the font dialog box shows it shows with Arial 48 pt.  But if I use:


    dlgFont.Font = (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString("Arial, 48 pt, Bold");


    the thrown exception tells that it can't parse the string and shows me the syntax which says to add [, Style] but nothing I tried for style works.


    An additional challenge is finding a format that will accept the bitwise OR so I can combine Bold and Italic.


    Any suggestions on this or another approach to updating the font dialog box?


    Kyle

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”