本文介绍了在Winforms上使用自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果我在自己的Winform上使用自定义字体,标签,然后构建解决方案,然后.ZIP文件在\\\\\\Release \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

如果不是这样,在Labels.Text上使用自定义字体的正确方法是什么?

解决方案

将字体嵌入为资源(或将其包含在bin目录中),然后使用


I have a label on my Winform and I want to use a custom font called XCalibur to make it appear more shnazzy.

If I use a custom font on a label and then build the solution and then .ZIP the files in \bin\Release will the end user see the labels with my custom app I used regardless if they have that font installed or not?

If this isn't the case, what's the proper way to use Custom Fonts on Labels.Text?

解决方案

Embed the font as a resource (or just include it in the bin directory), and then use the PrivateFontCollection to load the font (See the AddFontFile and AddMemoryFont functions). You then use the font normally like it was installed on the machine.

Source

这篇关于在Winforms上使用自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 13:01
查看更多