【发布时间】:2010-11-20 08:58:20
【问题描述】:
我正在尝试在 Windows 移动应用程序中实现双缓冲绘图。但我仍然看到闪烁。我在我的渲染代码(此处未显示)中使用 InvalidateRect(),而不是更新整个窗口。当我更新/绘制时,此 API 中提到的矩形闪烁。请帮忙
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
//hdc = GetDC(hWnd);
HDC newDC = CreateCompatibleDC(hdc);
HBITMAP hBitmap;
hBitmap = CreateCompatibleBitmap(hdc,width, height);
SelectObject(newDC,hBitmap));
BitBlt(hdc,0,0,width, height,newDC,0,0,SRCCOPY);
DeleteDC(newDC);
DeleteObject(hBitmap);
EndPaint(hWnd, &ps);
//ReleaseDC(hWnd,hdc); //Using this causes WM_PAIN fired without any reason.
}
break;
【问题讨论】:
标签: winapi visual-c++ windows-mobile