i'm getting flickers on windows. the windows have CW_USEDEFAULT size and i use the WS_CLIPCHILDREN.
on WM_PAINT i use my image class with client rect size.
it's big. but not more big than screen.
the WM_PAINT:
case WM_ERASEBKGND:
{
return (LRESULT)1;;
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(inst->hwnd, &ps);
RECT a;
GetClientRect(inst->hwnd, &a);
image imgpaint(a.right,a.bottom);//creates an image with form\window size
imgpaint.Brush(inst->clrBackColor);
pen test;
imgpaint.Pen(test);
imgpaint.DrawRectangle(0,0,imgpaint.width()+1, imgpaint.height()+1);
if (inst->Paint!=NULL)
inst->Paint(imgpaint);
//draws the image on HDC form\window
BitBlt(ps.hdc, inst->pntScrollDC.x,inst->pntScrollDC.y , imgpaint.width(), imgpaint.height(), imgpaint,0 ,0, SRCCOPY);
//inst->pntScrollDC it's the scroll position, but on start it's 0(zero)
EndPaint(inst->hwnd, &ps);
return 0;
}
break;
and see the Refresh() function:
void Refresh()
{
RECT a;
GetClientRect(hwnd,&a);
InvalidateRect(hwnd,&a,FALSE);
}
creating the window:
hwnd = CreateWindowEx(WS_EX_LAYERED,classname, strCaption.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, mod, this);
showing these: how can i avoid the flickers on form?
(i use a timer animation in these situation)
i can Refresh() the window with a RECT, but the brush color must be changed to backcolor;