在 CPropertySheet/CDialog 上使用 ModifyStyle 和 WS_THICKFRAME [英] Using ModifyStyle with WS_THICKFRAME on a CPropertySheet/CDialog

查看:62
本文介绍了在 CPropertySheet/CDialog 上使用 ModifyStyle 和 WS_THICKFRAME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 CPropertySheet.

I have a CPropertySheet.

当我使用

ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME | WS_MAXIMIZEBOX);

在 OnCreate 处理程序中一切正常.创建的窗口按预期运行并且可以调整大小.

inside an OnCreate handler everything is fine. The created window behaves as expected and is resizable.

当我使用相同的代码时,在 CPropertySheet::OnInitDialog 中比此代码稍晚一点的效果只会显示正确的框架,当我拖过窗口边框时,光标也会发生变化.但是没有调整大小功能.

When I use the same code, just a tick later in CPropertySheet::OnInitDialog than this code has only the effect that the correct frame is shown, also the cursor changes when I drag over the window border. But there is no resize feature.

在 OnInitDialog 中使用时,CDialog 也会发生同样的情况.某些标志在创建窗口后无法更改的接缝.

Same happens for a CDialog when uses in OnInitDialog. Seams that some flags can't be changed after a window is created.

是否有关于此问题的更多信息?

Is there more information about this problem?

推荐答案

您需要设置nFlags 参数到 SWP_FRAMECHANGED ,也可能是 SWP_DRAWFRAME 在您调用 ModifyStyle.这样它就会调用 SetWindowPos 内部,将应用新样式.您还需要删除 WS_SYSMENU 而不是 DS_MODALFRAME.

You need to set the nFlags parameter to SWP_FRAMECHANGED and maybe also SWP_DRAWFRAME in your call to ModifyStyle. This way it will call SetWindowPos internally, which will apply the new style. You also need to remove WS_SYSMENU instead of DS_MODALFRAME.

示例:

ModifyStyle(WS_SYSMENU, WS_POPUP | WS_THICKFRAME | WS_MAXIMIZEBOX, SWP_FRAMECHANGED);

这篇关于在 CPropertySheet/CDialog 上使用 ModifyStyle 和 WS_THICKFRAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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