16,472
社区成员
发帖
与我相关
我的任务
分享
void CMyImageDlg::OnNcMouseMove(UINT nHitTest, CPoint point)
{
static CPoint lastPt;
CRect rc;
GetWindowRect(rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{// afxDump << lastPt << "\n";
MoveWindow(rc.left+point.x-lastPt.x,rc.top+point.y-lastPt.y,rc.Width(),rc.Height());
GetCursorPos(&point);
}
lastPt=point;
// CDialog::OnNcMouseMove(nHitTest, point);
}
这段代码放 :
OnNcHitTest(CPoint point)
将使 全窗口 都可以移动.
//
void CMyImageDlg::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
static CPoint lastPt;
lastPt=point;
if(nHitTest==HTCAPTION)
{
CRect rc;
GetWindowRect(rc);
while(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{//
afxDump << lastPt << "\n";
MoveWindow(rc.left+point.x-lastPt.x,rc.top+point.y-lastPt.y,rc.Width(),rc.Height());
GetCursorPos(&point);
}
}
else
{
CDialog::OnNcLButtonDown(nHitTest, point);
}
}