Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Font Dialog box

Status
Not open for further replies.

kyledunn

Programmer
Jan 2, 2001
145
US
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?

Kyle

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top