【发布时间】:2011-07-23 17:08:56
【问题描述】:
我有一个 type = frame 的对话框图片控件,我已将它用作其他东西的父级。 当子窗口被销毁时,剩余部分留在控件中。我该怎么做才能清除控件或导致子窗口消亡以清除控件?
winapi c++
【问题讨论】:
标签: winapi dialog picturebox
我有一个 type = frame 的对话框图片控件,我已将它用作其他东西的父级。 当子窗口被销毁时,剩余部分留在控件中。我该怎么做才能清除控件或导致子窗口消亡以清除控件?
winapi c++
【问题讨论】:
标签: winapi dialog picturebox
我认为可能有一种更简单的方法,但以下方法可以解决问题,并允许您随意着色。
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);
甚至更好
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);
【讨论】: