0

I have a dialog picture control of type = frame that I've used as a parent for something else. When the child window is destroyed, the remnants are left in the control. What can I do to either clear the control or cause the demise of the child window to clear the control?

winapi c++

skaffman
  • 398,947
  • 96
  • 818
  • 769
Mike D
  • 2,753
  • 8
  • 44
  • 77

1 Answers1

0

I thought there might be a simpler method but the following does the trick and allows you to color it however you like.

            int s;
            HDC dc;
            RECT R;

            z  = GetDlgItem (hDlg, IDC_PS_AREA);        // clear the containing control
            dc = GetWindowDC (z);
            s  = GetClientRect (z,&R);

            FillRect (dc, &R, (HBRUSH) GetStockObject (LTGRAY_BRUSH));

            ReleaseDC (z, dc);

And even better

            int      s;
            HDC      dc;
            RECT     R;
            HBRUSH   hB;

            z  = GetDlgItem          (hDlg, IDC_PS_AREA);   // clear the parent containing control
            dc = GetWindowDC         (z);
            s  = GetClientRect       (z,&R);

            hB = GetSysColorBrush (COLOR_3DFACE);

            FillRect (dc, &R, hB);

            ReleaseDC (z, dc);
Mike D
  • 2,753
  • 8
  • 44
  • 77