Dynamically resizing CMFCPropertySheet with PropSheetLook_OneNoteTabs style

那年仲夏 提交于 2019-12-02 08:08:43

问题


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

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.

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 style OneNote http://www.freeimagehosting.net/uploads/th.ec91600664.jpg

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

Any idea? A MFC Feature Pack bug?


回答1:


I found the problem. One needs to get a reference to the different tab control the OneNote version uses via GetTab() and resize it accordingly.




回答2:


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. 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.


来源:https://stackoverflow.com/questions/378408/dynamically-resizing-cmfcpropertysheet-with-propsheetlook-onenotetabs-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!