BOOL OptionsDialog::OnInitDialog() { CPropertySheet::OnInitDialog(); // Enable context sensitive help ModifyStyleEx(0,WS_EX_CONTEXTHELP); // Create the font to use m_font.CreateFontIndirect(&m_logFont); // Set the font for the property pages ChangeDialogFont(this,&m_font); CPropertyPage* page = GetActivePage(); for (int i = 0; i < GetPageCount(); i++) { SetActivePage(i); CPropertyPage* page = GetActivePage(); ChangeDialogFont(page,&m_font); } SetActivePage(page); // Resize the property page CTabCtrl* tab = GetTabControl(); tab->GetWindowRect(&m_page); ScreenToClient(&m_page); tab->AdjustRect(FALSE,&m_page); page->MoveWindow(&m_page); return TRUE; }
LRESULT CCustomPropSheet::OnResizePage(WPARAM /*wParam*/, LPARAM /*lParam*/) { CPropertyPage* pCurPage = GetActivePage(); ASSERT(pCurPage != NULL); pCurPage->MoveWindow(&m_rcPage); return (0); }
BOOL CCustomPropSheet::OnInitDialog(void) { __super::OnInitDialog(); // get the font for the first active page CPropertyPage* pCurPage = GetActivePage(); ASSERT(pCurPage != NULL); // change the font for the sheet ChangeDialogFont(this, &m_fontPage, CDF_CENTER); // change the font for each page for (int i = 0, cPages = GetPageCount(); i < cPages; ++i) { CPropertyPage* pPage = GetPage(i); ASSERT(pPage != NULL); #if !defined(_BUGFIX_) ChangeDialogFont(pPage, &m_fontPage, CDF_CENTER); #else ChangeDialogFont(pPage, &m_fontPage, CDF_TOPLEFT); #endif // _BUGFIX_ } // set and save the size of the page CTabCtrl* pTab = GetTabControl(); ASSERT(pTab != NULL); if ((m_psh.dwFlags & PSH_WIZARD) != 0) { pTab->ShowWindow(SW_HIDE); #if !defined(_BUGFIX_) GetClientRect(&m_rcPage); CWnd* pButton = GetDlgItem(ID_WIZBACK); ASSERT(pButton != NULL); CRect rectButton; pButton->GetWindowRect(rectButton); ScreenToClient(rectButton); m_rcPage.bottom = rectButton.top - 2; #else CRect rectDivider; CWnd* pDivider = GetDlgItem(0x3026); ASSERT(pDivider != NULL); pDivider->GetWindowRect(rectDivider); ScreenToClient(rectDivider); m_rcPage.bottom = rectDivider.top - 2; #endif // _BUGFIX_ } else { pTab->GetWindowRect(&m_rcPage); ScreenToClient(&m_rcPage); pTab->AdjustRect(FALSE, &m_rcPage); } // resize the page pCurPage->MoveWindow(&m_rcPage); return (TRUE); }
LONG OptionsDialog::OnResizePage(UINT, LONG) { CPropertyPage* page = GetActivePage(); page->MoveWindow(&m_page); return 0; }
void CExtChildResizablePropertySheet::_TrickSyncActviveChild() { CPropertyPage * pWnd = CPropertySheet::GetActivePage(); CTabCtrl * pTabCtrl = CPropertySheet::GetTabControl(); if( pWnd != NULL && pWnd->GetSafeHwnd() != NULL && ::IsWindow( pWnd->GetSafeHwnd() ) && pTabCtrl != NULL && pTabCtrl->GetSafeHwnd() != NULL && ::IsWindow( pTabCtrl->GetSafeHwnd() ) ) { if( !m_bTabStylesInitialized ) { m_bTabStylesInitialized = true; DWORD dwStylesRemove = 0L; DWORD dwStylesAdd = 0L; if( m_bInitTabSingleLine ) { dwStylesRemove |= TCS_MULTILINE; dwStylesAdd |= TCS_SINGLELINE; } if( m_bInitTabButtons ) { dwStylesAdd |= TCS_BUTTONS; if( m_bInitTabButtonsFlat ) dwStylesAdd |= TCS_FLATBUTTONS; } if( dwStylesRemove != 0 || dwStylesAdd != 0 ) pTabCtrl->ModifyStyle( dwStylesRemove, dwStylesAdd, SWP_FRAMECHANGED ); if( m_bInitTabButtons && m_bInitTabButtonsFlat && m_bInitTabSeparatorsFlat ) pTabCtrl->SetExtendedStyle( TCS_EX_FLATSEPARATORS, TCS_EX_FLATSEPARATORS ); } RECT lpRect; GetClientRect(&lpRect); // dirty fix of the access vialation bug of // the tab control with single item when item's // width/height is same as tab control width/height __try { pTabCtrl->AdjustRect(FALSE, &lpRect); } __except( EXCEPTION_EXECUTE_HANDLER ) { lpRect.right ++; lpRect.bottom ++; __try { pTabCtrl->AdjustRect(FALSE, &lpRect); } __except( EXCEPTION_EXECUTE_HANDLER ) { } } pWnd->MoveWindow(&lpRect, TRUE); } }