How to keep the image displaying in the static control when resizing the dialog?

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

Yan Yang

Guest
I have created a static control to display images. The image can be displayed in the static control, but the image cannot keep displaying when resizing the dialog. When the dialog is enlarged, the image is kept displaying, but the image disappears when decreasing the size of dialog.

The code in OnSize() on the dialog 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, rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
pChild->UpdateData(FALSE);
}
}

How to make the image kept in the static control when resizing the dialog?

Thanks in advance.

Continue reading...
 
Back
Top