所有操作都发生在c ++ win32应用程序中。 目前使用的直接填充方法(经常重绘以使其闪烁):
RECT r;
PAINTSTRUCT ps;
RECT mRect;
brush_real = CreateSolidBrush(RGB(0, 0, 0));
{
dc = GetDC(GetDlgItem(hwnd, 1));
GetClientRect(GetDlgItem(hwnd, 1), &mRect);
FillRect(dc, &mRect, brush_real);
HBRUSH circleBrush = CreateSolidBrush(RGB(Roriginal, Goriginal, Boriginal)), oldBrush;
oldBrush = (HBRUSH)SelectObject(dc, circleBrush);
Ellipse(dc, mRect.left, mRect.top, mRect.right, mRect.bottom);
SelectObject(dc, oldBrush);
ReleaseDC(GetDlgItem(hwnd, 1), dc);
DeleteObject(oldBrush);
DeleteObject(circleBrush);
}
DeleteObject(brush_real);
这不能完全按预期工作,因为椭圆绘制在fillrect(填充黑色背景)后绘制时闪烁,我还没有弄清楚如何在对话框初始化对象初始化时如何填充背景。 你能提供什么?