16,472
社区成员
发帖
与我相关
我的任务
分享
CRect rClient;
GetWindowRect(&rClient);
m_DlgSize.cx = rClient.Width();
m_DlgSize.cy = rClient.Height();
void CTestDlg::OnSizing(UINT fwSide, LPRECT pRect)
{
switch (fwSide)
{
case 1: // 左
m_DlgSize.cx = pRect->right - pRect->left;
break;
case 2: // 右
pRect->right = pRect->left + m_DlgSize.cx;
break;
case 3: // 上
pRect->top = pRect->bottom - m_DlgSize.cy;
break;
case 4: // 左上
pRect->left = pRect->right - m_DlgSize.cx;
pRect->top = pRect->bottom - m_DlgSize.cy;
break;
case 5: // 右上
pRect->right = pRect->left + m_DlgSize.cx;
pRect->top = pRect->bottom - m_DlgSize.cy;
break;
case 6: // 下
pRect->bottom = pRect->top + m_DlgSize.cy;
break;
case 7: // 左下
pRect->left = pRect->right - m_DlgSize.cx;
pRect->bottom = pRect->top + m_DlgSize.cy;
break;
case 8: // 右下
pRect->right = pRect->left + m_DlgSize.cx;
pRect->bottom = pRect->top + m_DlgSize.cy;
break;
}
CDialog::OnSizing(fwSide, pRect);
// TODO: Add your message handler code here
}