void CDlgLogin::OnLButtonDown(UINT nFlags, CPoint point)
{
m_btnZoom.GetWindowRect(&m_rect);
ScreenToClient(&m_rect);
if(m_rect.PtInRect(point))
{
m_bZoomWindow = TRUE;
}
else
{
m_bMoveWindow = TRUE;
}
m_Pos = point;
SetCapture();
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgLogin::OnLButtonUp(UINT nFlags, CPoint point)
{
if (m_bMoveWindow)
m_bMoveWindow = FALSE;
m_bZoomWindow = FALSE;
ReleaseCapture();
CDialog::OnLButtonUp(nFlags, point);
}
void CDlgLogin::OnMouseMove(UINT nFlags, CPoint point)
{
//缩放窗口
if(m_bZoomWindow)
{
CRect crWindow;
GetWindowRect(&crWindow);
ClientToScreen(&point);
crWindow.SetRect(crWindow.left,crWindow.top,point.x,point.y);
if( theWindowManager->m_bMainStyle == FALSE )
::MoveWindow(theWindowManager->GetMainWnd(),crWindow.left,crWindow.top,crWindow.Width() ,crWindow.Height() , TRUE);
Invalidate();
}
//移动窗口
if (m_bMoveWindow && !m_bZoomWindow)
{
CPoint newPoint;
newPoint = point;
ClientToScreen(&newPoint);
//
newPoint.x = newPoint.x - m_Pos.x;
newPoint.y = newPoint.y - m_Pos.y;
CRect crWindow;
GetWindowRect(&crWindow);
crWindow.OffsetRect(point);
crWindow.SetRect(newPoint.x, newPoint.y, crWindow.Width() + newPoint.x, crWindow.Height() + newPoint.y);
if( theWindowManager->m_bMainStyle == FALSE )
::MoveWindow(theWindowManager->GetMainWnd(),crWindow.left,crWindow.top,crWindow.Width(),crWindow.Height(), TRUE);
}
CRect rect;
GetClientRect(&rect);
ClientToScreen(&rect);
rect.top = rect.bottom - 10;
rect.left = rect.right - 10;
CPoint pt;
GetCursorPos(&pt);
if(rect.PtInRect(pt))
{
SetCursor(LoadCursor(NULL,MAKEINTRESOURCE(IDC_SIZENWSE)));
}
CDialog::OnMouseMove(nFlags, point);
}