Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set button font to Marlett

I'm attempting to set a font of button to system's Marlett font. However, though I manually set the font-face, other font is used. Also, Marlett is not listed, when I use the font dialog to choose a font for that button.

Why is it so? What can I do to use Marlett font in .NET Windows Forms controls?

like image 833
Spook Avatar asked Apr 24 '13 12:04

Spook


1 Answers

Though I do not know what code is behind the designer, I have always found that custom installed fonts do not show up in the designer. The good news is that the Font property is ambient so if you wanted all controls to have the same Font you would only have to set it at the Form. However, it seems like you just want one control to have the Font so let's do this:

ctrl.Font = new Font("Marlett", 8.5f);

which will set that control's Font to Marlett and a size of 8.5 for example.

If you wanted an entire set of controls to have the same Font, if they can be placed in a container like a Panel, then you would only have to set the Font of the Panel; because again, it's an ambient property.

like image 94
Mike Perrenoud Avatar answered Sep 27 '22 18:09

Mike Perrenoud