Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change font of a label with custom font [duplicate]

Is possible change the font of label in C# with a custom font. EX.: I need change the font to Bookman Old Style and in Visual Studio doesn't have this font.

Is possible add? How?

like image 320
Ladessa Avatar asked Dec 21 '25 17:12

Ladessa


1 Answers

Use the PrivateFontCollection to load the font (See the AddFontFile and AddMemoryFont). You then use the font normally for label control.

PrivateFontCollection pfc = new PrivateFontCollection();
pfc.AddFontFile("C:\\Path To\\YourFont.ttf");
label1.Font = new Font(pfc.Families[0], 16, FontStyle.Regular);
like image 52
KF2 Avatar answered Dec 24 '25 07:12

KF2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!