使用 PropSheetLook_OneNoteTabs 样式动态调整 CMFCPropertySheet 的大小

2022-01-12 00:00:00 mfc mfc-feature-pack

我正在尝试动态调整 CMFCPropertySheet 的大小以在每个页面的底部添加自定义控件.

I'm trying to resize dynamically a CMFCPropertySheet to add a custom control at the bottom of each page.

由于所有属性页的高度不同,我有一种机制可以在必要时增加大小.为此,我重写了 OnActivatePage 方法,通过使用 SetWindowPos,我可以调整工作表的大小,首先是选项卡控件,然后是页面,最后我可以移动确定/取消/帮助按钮.

As all Property Pages are not of the same height, I have a mechanism to increase the size if necessary. For this, I have overridden the OnActivatePage method and by using SetWindowPos, I can resize the sheet, first, then the tab control, then the page and finally I can move the OK/Cancel/Help buttons.

它适用于 PropSheetLook_OutlookBarPropSheetLook_Tabs 样式,但不适用于 PropSheetLook_OneNoteTabs 样式.页面(或选项卡)未正确调整大小(页面的浅灰色未填满工作表.

It works fine with PropSheetLook_OutlookBar and PropSheetLook_Tabs styles but not with PropSheetLook_OneNoteTabs style. The page (or the tab) is not correctly resized (the lighter grey color of the page does not fill the sheet.

OneNote 风格 OneNote http://www.freeimagehosting.net/uploads/th.ec91600664.jpg

OneNote style OneNote http://www.freeimagehosting.net/uploads/th.ec91600664.jpg

Outlook 风格 Outlook http://www.freeimagehosting.net/uploads/th.319b6938ab.jpg

Outlook style Outlook http://www.freeimagehosting.net/uploads/th.319b6938ab.jpg

有什么想法吗?MFC 功能包错误?

Any idea? A MFC Feature Pack bug?

推荐答案

只需按照 here 中的说明进行操作.尽管这些说明适用于 CPropertySheet,但它们也适用于 CMFCPropertySheet.

Just follow the instructions as seen in here. Although the instructions are for CPropertySheet they work for the CMFCPropertySheet as well.

部分代码已弃用,因此您需要进行以下修改.

Some parts of the code is deprecated so you will need to make the following amendments.

  1. 完全跳过 XmnPropSheetCallback 和 DoModal 实现
  2. OnInitDialog 中只需调用 CPropertySheet::OnInitDialog(); 然后调用 OnSize 而不是执行该代码中的所有操作.
  1. Skip the XmnPropSheetCallback and DoModal implementations completely
  2. In OnInitDialog just make a call to CPropertySheet::OnInitDialog(); and then call OnSize instead of doing everything presented in that code.

相关文章