compact-framework - 如何在 Compact Framework 上使用带有双缓冲的 ClearType?

标签 compact-framework gdi+ antialiasing cleartype

当我将字符串绘制到缓冲区中时,生成的输出并未按照我期望的方式进行抗锯齿处理。此代码说明了问题...只需将其放入标准智能设备项目的 Form1.cs 中即可:

protected override void OnPaint(PaintEventArgs e)
{
  Bitmap buffer = new Bitmap(Width, Height, PixelFormat.Format32bppRgb);
  using(Graphics g = Graphics.FromImage(buffer))
  {
    g.Clear(Color.White);
    g.DrawString("Hello, World", Font, new SolidBrush(Color.Black), 5, 5);
  }
  e.Graphics.DrawImage(buffer, 0, 0);
}

另一方面,如果我只是将字符串绘制到随 PaintEventArgs 传入的 Graphics 对象中,它就会按照我的预期以 ClearType 呈现。

我认为我必须以某种方式创建图形缓冲区,使其使用字体平滑,但我没有找到方法来做到这一点。

最佳答案

事实证明这是一个简单的问题。通过删除 PixelFormat.Format32bppRgb ,它工作得很好。看起来您需要确保缓冲区具有相同的像素格式...

关于compact-framework - 如何在 Compact Framework 上使用带有双缓冲的 ClearType?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1187945/

相关文章:

c# - 我自己的 Win CE 任务栏

c# - GDI+能实现颜色循环吗?

c# - 使用 System.Diagnostics.Process.Start 运行程序会导致 MissingMethodException

c# - Convert.FromBase64String c# 上的 FormatException

C++ gdi 图像数组

c++ - GDI+:绘制位图时出现未处理的异常

c++ - 为 QPushButton 启用抗锯齿

CSS - 在 IE 中调整图像大小丢失分辨率(别名)

c++ - 如何在 Qt/hook QPainter 中渲染没有抗锯齿的 SVG 以避免抗锯齿?

.net - 如何在智能手机应用程序中的 DataGrid 中获取选定的行?