void CTestDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if (nType==SIZE_RESTORED)
{
CStatic * myStatic = (CStatic *)GetDlgItem(1000);
if(myStatic!=NULL&&IsWindow(myStatic->m_hWnd))
{
CRect rect;
GetClientRect(&rect);
CRect StaticRect;
myStatic->GetClientRect(&StaticRect);
myStatic->SetWindowPos(NULL, rect.Width() - 40, rect.Height() - 60, StaticRect.Width() , StaticRect.Height() , 0);
}
}
// TODO: 在此处添加消息处理程序代码
}
上边这段代码可以使用