Is it not possible to Paste Chinese Characters on Windows Form Text Box(Windows 窗体文本框不能粘贴汉字吗)
问题描述
我正在开发一个 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 窗体文本框不能粘贴汉字吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Windows 窗体文本框不能粘贴汉字吗
基础教程推荐
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
