开发者

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

开发者 https://www.devze.com 2023-02-25 00:52 出处:网络
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 a

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 thi开发者_StackOverflow中文版s?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消