void CHWParkDlg::OnSizing(UINT fwSide,LPRECT pRect)
{
CDialog::OnSizing(fwSide, pRect);
// TODO: Add your message handler code here
CRect rect(pRect);
int width=rect.Width();
int height=rect.Height();
switch(fwSide)
{
case WMSZ_BOTTOM:
{
if(height<MINDLG_HEIGHT)
pRect->bottom=pRect->top+MINDLG_HEIGHT;
break;
}
case WMSZ_LEFT:
{
if(width<MINDLG_WIDTH)
pRect->left=pRect->right-MINDLG_WIDTH;
break;
}
case WMSZ_RIGHT:
{
if(width<MINDLG_WIDTH)
pRect->right=pRect->left+MINDLG_WIDTH;
break;
}
case WMSZ_TOP:
{
if(height<MINDLG_HEIGHT)
pRect->top=pRect->bottom-MINDLG_HEIGHT;
break;
}
case WMSZ_TOPLEFT:
{
if(width<MINDLG_WIDTH)
pRect->left=pRect->right-MINDLG_WIDTH;
if(height<MINDLG_HEIGHT)
pRect->top=pRect->bottom-MINDLG_HEIGHT;
break;
}
case WMSZ_TOPRIGHT:
{
if(width<MINDLG_WIDTH)
pRect->right=pRect->left+MINDLG_WIDTH;
if(height<MINDLG_HEIGHT)
pRect->top=pRect->bottom-MINDLG_HEIGHT;
break;
}
case WMSZ_BOTTOMLEFT:
{
if(width<MINDLG_WIDTH)
pRect->left=pRect->right-MINDLG_WIDTH;
if(height<MINDLG_HEIGHT)
pRect->bottom=pRect->top+MINDLG_HEIGHT;
break;
}
case WMSZ_BOTTOMRIGHT:
{
if(width<MINDLG_WIDTH)
pRect->right=pRect->left+MINDLG_WIDTH;
if(height<MINDLG_HEIGHT)
pRect->bottom=pRect->top+MINDLG_HEIGHT;
break;
}
}
}
转载于:https://www.cnblogs.com/kangwang1988/archive/2011/07/19/2110986.html