Here's what I'm talking about: program window
I know this topic has been published several times, but I can’t find a good solution. My problem:
1 .: -flickering controls showing time and bar graph (static, not double buffer).
2 .: - I can’t change the background of the controls (labels, trackbar girlfriends, bkgnd histogram) from white to LTGRAY_BRUSH.
And here is 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);
leads to the fact that only trackballs are drawn without a frame. I tried using timers to nullify and redraw the controls, but that doesn't help. Now I have no idea how to fix this. Can someone help me please?