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 窗体文本框不能粘贴汉字吗


- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- 使用 rss + c# 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01