Reputation:
am trying to move a custom button whose base class is CWnd, am using MoveWindow() method but each time i move the window the previously drawn window is still visible. i tryed to call InvalidateWindow, InvalidateRect together with UpdateWindow on the parent window but all didn't work. i also tried RedrawWindow nothing happend. how can i properly update the parent window with the new position of the button? here is my sample code
void CCalendarCtrl::Shift()
{
RECT rc;
m_Up.GetWindowRect(&rc);
rc.top -= 20;
rc.bottom -=20;
m_Up.MoveWindow(&rc,TRUE);
RedrawWindow();
}
Upvotes: 1
Views: 885
Reputation: 4335
GetWindowRect returns screen coordinates. MoveWindow works using Client coordinates. So you need to do ScreenToClient(&rc) between the two calls.
Upvotes: 1