响应WM_SIZING消息,消息函数中做如下处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | void CDemoDlg::OnSizing(UINT fwSide, LPRECT pRect) { if (pRect->right - pRect->left < minWidth_) { if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT) { pRect->left = pRect->right - minWidth_; } else pRect->right = pRect->left + minWidth_; } if (pRect->bottom - pRect->top < memHdcHeight_) { if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT) { pRect->top = pRect->bottom - minHeight_; } else pRect->bottom = pRect->top + minHeight_; } CDialogEx::OnSizing(fwSide, pRect); } |