如何使用ClearType与Compact Framework的双缓冲?
-
19-09-2019 - |
题
当我绘制一个字符串转换为缓冲液,所得到的输出是不抗锯齿我期望的方式。此代码说明了这个问题......只是把这个在一个标准的智能设备项目的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
它工作得很好。看起来你需要确保你的缓冲区具有相同的像素格式...
其他提示
设置显卡的SmoothingMode属性对象:
g.SmoothingMode = SmoothingMode.AntiAlias;
您将不得不使用gdiplus.dll的(存在于这几个包装),但它只能在Windows Mobile 6专业版(不是标准)。
不隶属于 StackOverflow