Here is what I'm talking about:program window
I know, this topic was several times published, but I can't find any good solution.
My problem is
1.: -flickering controls showing time and histogram (static, not double bufferred).
2.: -I can't change background of controls (labels, trackbar buddies, histogram bkgnd) from white to LTGRAY_BRUSH.
And here's some code:
case WM_PAINT:
PaintProcedure( hdcClock );
SetBkColor(hdcWindow, RGB(255,220,180));
TextOut(hdcWindow,260,10,TEXT(" -- CAMERA WINDOW -- "),21);
break;
... ...
void PaintProcedure( HDC hdc )
{
img = cam->getFrame();
cam->ShowImage(img, hdcCam, 1, 1, img->width, img->height, 0, 0);
InvalidateRect( hClock, &rClock, 1 );
RedrawWindow(hClock,&rClock,0,RDW_UPDATENOW);
char sTime[256];
SYSTEMTIME time;
HFONT hFont;
SIZE size;
...
...
BeginPath (hdc) ;
SetBkMode( hdc, TRANSPARENT/*OPAQUE*/ );
TextOut( hdc,1,1,sTime, strlen( sTime ) );
EndPath (hdc) ;
SelectObject (hdc, CreateHatchBrush (HS_DIAGCROSS, RGB (0, 0, 255))) ;
SetBkColor (hdc, RGB (255, 0, 0)) ;
SetBkMode (hdc, OPAQUE) ;
StrokeAndFillPath (hdc) ;
DeleteObject (SelectObject (hdc, GetStockObject (LTGRAY_BRUSH)));
SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
DeleteObject (hFont) ;
cam->ShowImage(cam->drawIntensityHistogram(),hdcHistogram,1,1,
rHistogram.right-rHistogram.left,rHistogram.bottom-rHistogram.top,0,0);
InvalidateRect( hwnd, &r, 1 );
RedrawWindow(hwnd,&r,0,RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
}
Adding this code:
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORDLG:
case WM_CTLCOLORBTN:
return (LRESULT)GetStockObject(LTGRAY_BRUSH);
causes that only trackbars are drawn without a frame. I tried to use timers to invalidate and redraw controls but it doesn't help. Now I have no idea how to fix it. Could someone help me, please?