调整对话框大小时如何在静态控件中保持图像显示? [英] How to keep the image displaying in the static control when resizing the dialog?

查看:57
本文介绍了调整对话框大小时如何在静态控件中保持图像显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个静态控件来显示图像。图像可以在静态控件中显示,但在调整对话框大小时图像无法继续显示。当对话框放大时,图像会保持显示,但是当对话框大小减少
时图像会消失。

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.

OnSize中的代码对话框中的()如下所示。

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?

在此先感谢。

推荐答案

BeginDeferWindowPos和EndDeferWindowPos在哪里?



此外,对DeferWindowPos的调用应该确保按照

DeferWindowPos函数
"此函数返回的句柄可能与传递给函数的句柄不同。在下次调用
DeferWindowPos
EndDeferWindowPos
功能。 "

Where are BeginDeferWindowPos and EndDeferWindowPos?

Also, the call to DeferWindowPos should make sure that the returned HDWP is used as discussed at DeferWindowPos function "The handle returned by this function may differ from the handle passed to the function. The new handle that this function returns should be passed during the next call to the DeferWindowPos or EndDeferWindowPos function. "


这篇关于调整对话框大小时如何在静态控件中保持图像显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆