15,979
社区成员
发帖
与我相关
我的任务
分享
void CDlg1::OnSize(UINT nType, int cx, int cy)
{
CBaseDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(IsWindow(m_Dlg1Sta1))// also m_Dlg1Edit1
{// when dlg1 moves.
CRect rcs;
CRect rce;
m_Dlg1Sta1.GetWindowRect(&rcs);
m_Dlg1Edit1.GetWindowRect(&rce);
// You will defer all the application's windows.
HDWP hdwp = BeginDeferWindowPos(2);
// First, "Please Input :"
DeferWindowPos(hdwp, m_Dlg1Sta1, NULL,
(cx-rcs.Width()-rce.Width())/2,(cy-rcs.Height())/2-20,
rcs.Width(), rcs.Height(),
SWP_NOZORDER);
// Next, Cedit.
DeferWindowPos(hdwp,m_Dlg1Edit1, NULL,
(cx-rcs.Width()-rce.Width())/2+rcs.Width()+2,(cy-rce.Height())/2-20,
rce.Width(), rce.Height(),
SWP_NOZORDER);
// redraw all the windows
EndDeferWindowPos(hdwp);
}
}