Dan
2003-07-10 16:41:29 UTC
Why is it when I execute this code, the (X,Y) coordinates are
different between block 1 and block 3 when pWnd is any control with a
border around it? Helk, I'm not even moving the control! However, if
the border style is turned off, the problem goes away. Is the border
considered in the call to GetClientRect()? This also happens with
static controls as well.
// block 1 (Get position of edit control in parent dialog)
pWnd->GetClientRect(&rect);
pWnd->MapWindowPoints(pParentWnd, &rect);
// block 2 (Stay in same place)
pWnd->MoveWindow(&rect); // or SetWindowPos()
// block 3 (Shows different values than block 1!!)
pWnd->GetClientRect(&rect);
pWnd->MapWindowPoints(pParentWnd, &rect);
different between block 1 and block 3 when pWnd is any control with a
border around it? Helk, I'm not even moving the control! However, if
the border style is turned off, the problem goes away. Is the border
considered in the call to GetClientRect()? This also happens with
static controls as well.
// block 1 (Get position of edit control in parent dialog)
pWnd->GetClientRect(&rect);
pWnd->MapWindowPoints(pParentWnd, &rect);
// block 2 (Stay in same place)
pWnd->MoveWindow(&rect); // or SetWindowPos()
// block 3 (Shows different values than block 1!!)
pWnd->GetClientRect(&rect);
pWnd->MapWindowPoints(pParentWnd, &rect);