我正在开发一个 WinForm 应用程序,并且我有一个文本框,我在其中粘贴来自 Google 翻译的文本.我在几种 Sematic 和 Indo Languages 中取得了积极的结果,但汉字显示为 Boxes.
有什么办法可以克服吗?
您应该使用支持 CJK 编码的适当 Unicode 字体.更好的是Arial Unicode MS",但它可能在没有安装 MS Office 的早于 Vista 的操作系统.在这种情况下,您可以使用其他字体,例如NSimSun".
<上一页>string arialUnicodeFontFace = "Arial Unicode MS";字体 unicodeFont = new Font(arialUnicodeFontFace, fontSize);if (unicodeFont.Name != arialUnicodeFontFace)unicodeFont = new Font("NSimSun", fontSize);yourTextBox.Font = unicodeFont;您还可以查看不同 Windows 版本中所有支持的 CJK 字体的列表:http://en.wikipedia.org/wiki/List_of_CJK_fonts
I am working on a WinForm App and I have a text box where I am pasting texts from Google Translator. I have got positive results with several Sematic and Indo Languages but Chinese characters appear as Boxes.
Is there any way to overcome this?
You should use appropriate Unicode font which supports CJK encodings. The better one is "Arial Unicode MS", but it may be absent on OS earlier than Vista without MS Office installed. In this case you may use another font like "NSimSun".
string arialUnicodeFontFace = "Arial Unicode MS"; Font unicodeFont = new Font(arialUnicodeFontFace, fontSize); if (unicodeFont.Name != arialUnicodeFontFace) unicodeFont = new Font("NSimSun", fontSize); yourTextBox.Font = unicodeFont;
You may also look at the list of all supported CJK fonts in different versions of Windows: http://en.wikipedia.org/wiki/List_of_CJK_fonts
这篇关于Windows 窗体文本框不能粘贴汉字吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!