Is it not possible to Paste Chinese Characters on Windows Form Text Box

倖福魔咒の 提交于 2019-11-30 05:47:30

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/5646548/is-it-not-possible-to-paste-chinese-characters-on-windows-form-text-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!