The static control doesn't move to the new position.

  • Thread starter Thread starter Yan Yang
  • Start date Start date
Y

Yan Yang

Guest
I am trying to move a static control to a new position when resizing the parent window, its size and horizonal position should not change, it should move along Y axis. I've checked that the position of the static control is updated when resizing the window, but it still stays in the same position on the screen. The code is below.

for (CWnd* pChild = GetWindow(GW_CHILD); pChild != NULL; pChild = pChild->GetWindow(GW_HWNDNEXT))
{
if (pChild->GetDlgCtrlID() == IDC_IMAGE)
{
pChild->GetWindowRect(&rcClient);
ScreenToClient(&rcClient);
rcClient.OffsetRect(0, dy);
::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, 0, 0, rcClient.Width(), rcClient.Height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
}


How can I change the position of the static control on the screen?

Thanks in advance.

Continue reading...
 
Back
Top