Using ModifyStyle with WS_THICKFRAME on a CPropert

2019-07-20 04:31发布

I have a CPropertySheet.

When I use

ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME | WS_MAXIMIZEBOX);

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

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.

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?

1条回答
【Aperson】
2楼-- · 2019-07-20 04:47

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.

Example:

ModifyStyle(WS_SYSMENU, WS_POPUP | WS_THICKFRAME | WS_MAXIMIZEBOX, SWP_FRAMECHANGED);
查看更多
登录 后发表回答