简体   繁体   English

使用Graphics.DrawString时的区别

[英]Difference when using Graphics.DrawString

I get different result using Graphics.DrawString when rendering a chart for ASP.NET website. 呈现ASP.NET网站的图表时,使用Graphics.DrawString获得不同的结果。 Text looks fine on development environment but bold and ugly on production. 文字在开发环境中看起来不错,但在生产中却大胆难看。 Chart sample on production is here . 有关生产的图表样本在这里 I can not post the link on chart sample from development environment, but I uploaded it on AmiProject website with name GanttChartOnDevelopment.png I have checked that required font in installed on production server. 我无法将链接发布到来自开发环境的图表示例中,但是我将其以GanttChartOnDevelopment.png的名称上传到AmiProject网站上,我已经检查了生产服务器上安装的所需字体。 Code I am using: 我正在使用的代码:

FontFamily fontFamily = new FontFamily("Arial");
m_Font = new Font(fontFamily, 8, FontStyle.Regular);
m_Bitmap = new Bitmap(bitmapWidth, RowHeight * taskCount, PixelFormat.Format24bppRgb);
m_Bitmap.MakeTransparent(m_Bitmap.GetPixel(1, 1));
m_Graphics = Graphics.FromImage(m_Bitmap);
m_Graphics.SmoothingMode = SmoothingMode.AntiAlias;
m_Graphics.DrawString(Text, m_Font, new SolidBrush(Color.Black), new PointF(r.Right + 7, r.Top - 7));

I am using .net 3.5. 我正在使用.net 3.5。 Production server is Windows 2008, Development - Windows XP SP3. 生产服务器是Windows 2008,开发版-Windows XP SP3。 Please help to understand the reason of that difference and fix that. 请帮助了解造成这种差异的原因并加以解决。

不太确定这是否会与位图绘图有所不同,但是您是否已检查服务器上是否启用了ClearType?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM