MFC GetClientRect/GetWindowRect after a MoveWindow
m_PICTURE_OD is an IDC_STATIC,
m_PICTURE_开发者_如何学GoOD.MoveWindow(640 /*x*/,96/*y*/,480/*w*/,288/*h*/);
RECT myrect;
m_PICTURE_OD.GetClientRect(&myrect);
myrect.bottom = 288; myrect.top = 0; myrect.left = 0; myrect.right = 480;
RECT myrect;
m_PICTURE_OD.GetWindowRect(&myrect);
myrect.bottom = 508; myrect.top = 220; myrect.left = 802; myrect.right = 1282;
I'd like to reobtain myrect.left = 640, myrect.top = 96 ...
What can I do ?
Thanks,
You are mixing screen coordinates and client coordinates. To translate between them, use CWnd::ScreenToClient
and CWnd::ClientToScreen
.
精彩评论