mfccpropertysheet

Update Property Page or Tab Control Layout


After changing the text in a tab control's tab header, how do I tell it to recalculate the layout of the children (e.g., if the new tabs take up two rows)?

I am changing the tab text like this, from within a property page:

TC_ITEM ti;
ti.mask = TCIF_TEXT;
ti.pszText = _T("whatever....");
CTabCtrl *pTabs = ((CPropertySheetEx *)GetParent())->GetTabControl();
pTabs->SetItem(m_nIdx, &ti);

Solution

  • I looked in the MFC source code (dlgprop.cpp, in VC++ 6.0) and specifically the:

    BOOL CPropertySheet::OnInitDialog()
    


    It seems that the calculations that you need are done there.

    Just try to call the OnInitDialog(). It does only property sheet window resizes.
    Of course, you can check the source code for more hints.