非常好的窗体自由缩放


void Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{

 CFileBrowserDlg *pDlg=(CFileBrowserDlg *)this->GetParent();
 CRect rcDialog;
 GetClientRect(&rcDialog) ;
 HCURSOR   hc;
 if(point.y>rcDialog.Height()-4 && point.y<rcDialog.Height())
 {
  hc=LoadCursor(NULL,IDC_SIZENS);
  SetCursor(hc);  
  pDlg->PostMessage( WM_NCLBUTTONDOWN,HTBOTTOM, MAKELPARAM( point.x, point.y));
 }
 if((point.y>rcDialog.Height()-7 && point.x>rcDialog.Width()-7))
 {
  hc=LoadCursor(NULL,IDC_SIZENWSE);
  SetCursor(hc);  
  pDlg->PostMessage( WM_NCLBUTTONDOWN,HTBOTTOMRIGHT, MAKELPARAM( point.x, point.y));
 }
 CDialog::OnLButtonDown(nFlags, point);
}


void Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
 HCURSOR   hc;
 CRect rcDialog;
 GetClientRect(&rcDialog) ;
 if((point.y>rcDialog.Height()-4 && point.y<rcDialog.Height()))
 {
  hc=LoadCursor(NULL,IDC_SIZENS);
  SetCursor(hc);  
 }
 if((point.y>rcDialog.Height()-7&& point.x>rcDialog.Width()-7))
 {
  hc=LoadCursor(NULL,IDC_SIZENWSE);
  SetCursor(hc);  
 }
 CDialog::OnMouseMove(nFlags, point);
}

你可能感兴趣的:(null)