傻了,大虾们来看看啊!
void CMyStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
CRect rect;
CPoint pointMouse;
::GetCursorPos(&pointMouse);
//ScreenToClient(&pointMouse);
GetWindowRect(&rect);
ScreenToClient(&pointMouse);
MoveWindow(pointMouse.x,pointMouse.y,rect.Width(),rect.Height());
ShowWindow(TRUE);
CStatic::OnLButtonDown(nFlags, point);
}
在上面,CMyStatic是继承了CStatic的类,当鼠标在其上面点饥时就让她移到鼠标的位置,可是不管是point是在它上面的点,而GetCursorPos得到是屏幕的点。我不知道该怎样纠正,用ScreenToClient好象不行。大家可以试试这个代码。
只要帮忙,都有分!