Originally Posted by
oogabooga
If there's no better solution and the background is unchanging, you could save it and use it to repaint the area before drawing new text.
sorry, but in these case, i wan't avoid the WM_PAINT
i can share the Region way, but i need ask: it's a persistente way?
Code:
HRGN GetControlRegion(HWND hwnd,color clrColor)
{
HDC hDC=GetDC(hwnd);
RECT rect;
GetWindowRect(hwnd,&rect);
int w=rect.bottom-rect.top;
int h=rect.right-rect.left;
HRGN hRgn = CreateRectRgn(0,0,0,0);
for (int x = 0; x < w; x++)
{
for (int y=0; y<h; y++)
{
if(GetPixel(hDC,x,y)!=clrColor)
{
HRGN hRgnTemp = CreateRectRgn(x, y, x, y+1);
CombineRgn(hRgn, hRgn, hRgnTemp, RGN_OR);
DeleteObject(hRgnTemp);
}
}
}
ReleaseDC(hwnd,hDC);
return hRgn;
}
when i use an image, with a diferent backcolor, the control backcolor still be the old or it's the new one?
anotherthing: i read something about InvaliteWindow() but seems not working or i'm not using the right message