更改菜单栏和工具栏的字体 [英] Changing the font of menustrips and toolstrips

查看:73
本文介绍了更改菜单栏和工具栏的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在开发一个C#应用程序,该应用程序必须在menustrips,toolstrips和其他标签上显示带有ℇ,ɛ,ɔ,等符号的文本.当我将上面的控件设置为支持这些字符的字体并为朋友编译发行版本时,他们声称特殊字符显示为方框.我想知道如果没有这些框,这样做是否很好.我什至尝试使用.ttf文件中的自定义字体,但仍然无法获取它.欢迎任何帮助.

Hi all,
I am developing a C# application which must the menustrips,toolstrips and other labels display text with symbols such as ℇ,ɛ,ɔ, . When I set the controls above to font which support these characters and compile a release version for friends, they claim the special characters get shown as boxes. I want to know if there is to do this nicely without the boxes. I even tried using custom fonts from .ttf files but still can''t get it. Please any help is welcomed.

推荐答案

我首先想到的是,您的朋友没有您使用的字体文件.发生这种情况时,操作系统会最好地猜测一种替换字体,该字体可能没有您正在使用的字符.在这种情况下,缺少的字符将显示为小占位符,表明其中存在某些系统不知道如何绘制的内容.

最简单的解决方案是确保您使用具有所需字符的通用字体. Windows计算机上的Arial字体具有所需的字符,并且应该在大多数(如果不是全部)用户的计算机上使用.

第二种解决方案是将字体文件添加到安装项目中,然后将其与您的应用程序一起安装.我不知道该怎么做,但是我无法想象这太困难了.
My first thought is that your friends do not have the font file that you used. When that happens, the OS makes a best guess at a replacement font, which might not have the characters you are using. In that case, the missing characters are rendered as small place holders, showing that there is something there that the system does not know how to draw.

The easiest solution would be to make sure you use a common font with the characters you need. The Arial font on my Windows machine has the characters you want, and should be on most, if not all, of your users'' machines as well.

The second solution would be to add your font file to the installation project, and have it installed with your app. I have no idea how to go about doing that, but I can''t imagine that it would be too difficult.


听起来像是本地化问题.阅读此CP文章 .NET-本地化 [
Sounds like a localisation issue. Have a read of this CP Article.NET - Localization[^]


添加字体的简便方法是
Easy way to add font would be
PrivateFontCollection pfc = new PrivateFontCollection();
            pfc.AddFontFile("path to font");
            label1.Font = new Font(pfc.Families[0], 16, FontStyle.Regular);



pfc.Families [0]是因为只向集合添加了一种字体.该系列将是font [index],说有更多字体文件,只需将它们添加到集合中,然后选择索引要使用的字体



the pfc.Families[0] is because there is only one font added to the collection. the Family would be the font[index] say there were more font files just add those to the collection then choose the font to use by the index


这篇关于更改菜单栏和工具栏的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆