MoveWindow之后的MFC GetClientRect / GetWindowRect

时间:2011-04-07 19:21:37

标签: mfc getclientrect

m_PICTURE_OD是IDC_STATIC,

m_PICTURE_OD.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;

我想重新获得myrect.left = 640,myrect.top = 96 ......

我该怎么办?

谢谢,

1 个答案:

答案 0 :(得分:1)

您正在混合屏幕坐标和客户端坐标。要在它们之间进行转换,请使用CWnd::ScreenToClientCWnd::ClientToScreen