Is double buffering supported in 开发者_如何学Gowindows mobile 6.5 CE
If you're drawing the controls yourself then you might want to consider performing your own double-buffering.
I haven't kept massively up to date with WinCE recently and would have assumed they'd eventually port the ease of double buffering you get on the desktop but perhaps they haven't.
Basically the premise is to just draw to an image and then to blit that image onto the "real" graphics object in one shot.
It's "something" like this (this from memory so idk if the syntax is perfect):
public class DoubleBufferedControl : Control
{
protected override OnPaint(object sender, PaintEventArgs e)
{
using(Bitmap bitmap = new Bitmap(Width, Height))
{
using(Graphics graphics = Graphics.FromImage(bitmap))
{
DoPaint(sender, new PaintEventArgs(graphics));
e.Graphics.DrawImage(bitmap, 0, 0);
}
}
}
protected virtual DoPaint(object sender, PaintEventArgs e)
{
/* left empty for overrides */
}
protected override OnPaintBackground(object sender, PaintEventArgs e)
{
/* do nothing */
}
}
Then make all your own controls inherit from this and add your painting code into an override of DoPaint.
You might want to opitmise the above to only create the bitmap once (ctor), handle the resize event and then recreate it on resize, then add some disposing code so you can .Dispose the bitmap when the object dies.
It really depends on exactly what you mean and where. Almost all CE display drivers use double-buffering for drawing from video memory to the display to prevent tearing and artifacts (I've never seen one that didn't).
If you're asking if some framework, like maybe the Compact Framework, MFC, Direct Show or whatever, supports it through the API, then we need to know what framework you're talking about.
精彩评论