主题:vc++6.0编的程序最小化然后最大化后程序出错
void CBei1Dlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
//设置控件随对话框大小变化而变化
int KjNum=1004;
CWnd *pWnd;
pWnd=GetDlgItem(KjNum);
if(pWnd)
{
CRect rect;
pWnd->GetWindowRect(&rect);
ScreenToClient(&rect);
rect.left=rect.left*cx/m_rect.Width();
rect.right=rect.right*cx/m_rect.Width();
rect.top=rect.top*cy/m_rect.Height();
rect.bottom=rect.bottom*cy/m_rect.Height();
pWnd->MoveWindow(rect);
}
GetClientRect(&m_rect);
}
上述是WM_SIZE代码,各位高手有没有更好的方法实现最大化,或者上面的代码该怎么改啊!
先谢谢了!
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
//设置控件随对话框大小变化而变化
int KjNum=1004;
CWnd *pWnd;
pWnd=GetDlgItem(KjNum);
if(pWnd)
{
CRect rect;
pWnd->GetWindowRect(&rect);
ScreenToClient(&rect);
rect.left=rect.left*cx/m_rect.Width();
rect.right=rect.right*cx/m_rect.Width();
rect.top=rect.top*cy/m_rect.Height();
rect.bottom=rect.bottom*cy/m_rect.Height();
pWnd->MoveWindow(rect);
}
GetClientRect(&m_rect);
}
上述是WM_SIZE代码,各位高手有没有更好的方法实现最大化,或者上面的代码该怎么改啊!
先谢谢了!