在WinXP中显示UniCode字符. [英] DIsplaying UniCode chars in WinXP.

查看:130
本文介绍了在WinXP中显示UniCode字符.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家.

我有一个基于小表格的应用程序.它显示unicode字符,该程序在Windows 7上可以正常工作,但在Windows XP上却无法运行.

为了测试,我创建了一个简单的程序,

该程序具有unicode文本,

在涂漆"事件中,文本将正确显示.
(在Win 7上=正确显示,在XP上=正确显示)

但是,如果在按钮标题上显示的字符串相同,则其字符将显示为空白矩形.
(在Win 7上正确显示,在XP上=空白矩形).

在Windows 7中没有问题,但是如果我在Windows XP下运行此程序,则
按钮的标题字符串显示为空白矩形.

我错过了什么吗?

pl.建议.

-prateek.


这是代码.

Hello Experts.

I have a small form based application. which displays unicode chars, this program works fine on windows 7. but fails on windows XP.

for testing i have created a simple program,

this program has a unicode text,

In the On Paint event the text is displayed properly.
(On Win 7 = displayed Properly, On XP = Displayed Properly)

but if the same string displayed on a Button''s caption it''s characters are displayed as blank rectangles.
(On Win 7 = displayed Properly, On XP = blank rectangles).

in windows 7 there is no problem, but if i run this program under windows XP, then
on button''s caption string is displayed as blank rectangles.

am i missing something.

pl. suggest.

-prateek.


here is the code.

public partial class TestForm : Form
   {
       string m_strText;
       public TestForm()
       {
           InitializeComponent();
       }


       private void TestForm_Paint(object sender, PaintEventArgs e)
       {
           Graphics g = e.Graphics;
           g.DrawString ( m_strText, 
                          new Font ( this.Font.FontFamily, 20 ), 
                          new SolidBrush ( Color.Blue), 
                          10, 10 ) ;
       }


       private void TestForm_Load(object sender, EventArgs e)
       {
           char [] szBuf = new char [] { (char)0x915, (char)0x916, 
                                           (char)0x917, (char)0x918 } ;
           int nCnt = szBuf .Length;
           for (int nC = 0; nC < szBuf.Length; nC++)
                 m_strText  += szBuf[nC];
       }

       private void btnGet_Click(object sender, EventArgs e)
       {
           btnGet.Text = m_strText;
           this.Text = m_strText;
       }
   }

推荐答案

您的表单中指定的确切字体是否同时安装在两台计算机上?Font属性? 如果在附件"->系统工具"->字符映射"中打开字符映射",并在两台计算机上打开相同的字体,那么您使用的所有字符是否都出现在这两个计算机中?

我的猜测是Visual Studio Designer使用的是默认字体(也许是Segoe UI),该字体在Windows 7上可以正常显示,但该字体在XP上不存在,因此在运行时会替换诸如MS Sans Serif之类的东西.替换的字体不具有与原始字体相同的所有unicode字符.
Is the exact font specified in your forms Font property installed on both computers?
If you open Character Map in Accessories->System Tools->Character Map and open the same font on both machines, are all of the characters that you are using present in both?

My guess is that the Visual Studio Designer is using a default font (maybe Segoe UI) which renders fine on Windows 7, but the font is not present on XP, so something else like MS Sans Serif is being substituted at run-time. The substituted font doesn''t have all of the same unicode characters that the original did.


这篇关于在WinXP中显示UniCode字符.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆