Beispiel #1
1
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
BOOL CEntityDialog::OnInitDialog()
{
	if( !CDialogEx::OnInitDialog() )
		return FALSE;

	//Create copy of editable entity
	m_oldEntity = GetActiveDocument()->GetSelectedEntity(0);
	m_newEntity = m_oldEntity->Clone();
	Assert( m_oldEntity && m_newEntity );
	GetActiveDocument()->GetEntityList()->ReplaceEntity( m_oldEntity, m_newEntity );
	GetActiveDocument()->SelectSingleEntity( m_newEntity );
	m_dialogClassInfo.SetEditEntity(m_newEntity);

	//Get Tab Control
	CTabCtrl *pTabCtrl = (CTabCtrl*)GetDlgItem(IDC_TAB1);

	//Create Tab Content dialog and adjust
	m_dialogClassInfo.Create(IDD_ENTITY_CLASS_INFO, pTabCtrl);

	TCITEM tcItem;
	tcItem.mask = TCIF_TEXT | TCIF_PARAM;
	tcItem.pszText = _T("Class Info");
	tcItem.lParam = (LPARAM)&m_dialogClassInfo;
	pTabCtrl->InsertItem(0, &tcItem);

	RECT wndrect;
	GetClientRect(&wndrect);
	wndrect.top -= 15;
	wndrect.bottom -= 30;
	pTabCtrl->AdjustRect( FALSE, &wndrect );
	pTabCtrl->MoveWindow( &wndrect );

	CRect rect;
	pTabCtrl->GetItemRect(0, &rect);
	m_dialogClassInfo.SetWindowPos(NULL, rect.left, rect.bottom + 1,
		wndrect.right-wndrect.left-10, wndrect.bottom-wndrect.top-30, /*SWP_NOSIZE |*/ SWP_NOZORDER );
	m_dialogClassInfo.ShowWindow(SW_SHOW);

	return TRUE;
}
Beispiel #2
1
void CuDlgCacheTab::DisplayPage (CACHELINEINFO* pData)
{
	CString csButtonTitle;
	CWnd* pParent1 = GetParent ();              // View (CvDbmsCacheViewRight)
	ASSERT_VALID (pParent1);
	CWnd* pParent2 = pParent1->GetParent ();    // SplitterWnd
	ASSERT_VALID (pParent2);
	CWnd* pParent3 = pParent2->GetParent ();    // Frame (CfDbmsCacheFrame)
	ASSERT_VALID (pParent3);
	CWnd* pParent4 = pParent3->GetParent ();    // Modeless Dialog (CuDlgDbmsCache)
	ASSERT_VALID (pParent4);

	CWnd* pParent5 = pParent4->GetParent ();    // CTabCtrl
	ASSERT_VALID (pParent5);
	CWnd* pParent6 = pParent5->GetParent ();    // CConfRightDlg
	ASSERT_VALID (pParent6);

	CButton* pButton1 = (CButton*)((CConfRightDlg*)pParent6)->GetDlgItem (IDC_BUTTON1);
	CButton* pButton2 = (CButton*)((CConfRightDlg*)pParent6)->GetDlgItem (IDC_BUTTON2);

	CuCacheCheckListCtrl* pList = GetCacheListCtrl();
	CTabCtrl* pTab = (CTabCtrl*)GetDlgItem(IDC_TAB1);
	if (m_pCurrentPage)
	{
		//
		// Try to save (and validate) the data that has been changed
		// in the old page before displaying a new page.
		m_pCurrentPage->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
		m_pCurrentPage->ShowWindow (SW_HIDE);
		m_pCurrentPage = NULL;
	}
	if (!(pTab && IsWindow (pTab->m_hWnd)))
		return;

	UINT nState = 0;
	int i, nCurSel = -1, nCount = pList->GetItemCount();
	for (i=0; i<nCount; i++)
	{
		nState = pList->GetItemState (i, LVIS_SELECTED);
		if (nState & LVIS_SELECTED)
		{
			nCurSel = i;
			break;
		}
	}
	if (nCurSel == -1)
		return;
	if (!pData)
		return;
	try
	{
		if (!VCBFllInitCacheParms(pData))
			return;
		int nSel = pTab->GetCurSel();
		switch (nSel)
		{
		case 0:
			csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
			pButton1->SetWindowText (csButtonTitle);

			csButtonTitle.LoadString(IDS_BUTTON_RESTORE);
			pButton2->SetWindowText (csButtonTitle);
			if (!m_pCacheParameter)
			{
				m_pCacheParameter = new CuDlgDbmsCacheParameter (pTab);
				m_pCacheParameter->Create (IDD_DBMS_PAGE_CACHE_PARAMETER, pTab);
			}
			m_pCurrentPage = m_pCacheParameter;
			break;
		case 1:
			csButtonTitle.LoadString(IDS_BUTTON_EDIT_VALUE);
			pButton1->SetWindowText (csButtonTitle);

			csButtonTitle.LoadString(IDS_BUTTON_RECALCULATE);
			pButton2->SetWindowText (csButtonTitle);

			if (!m_pCacheDerived)
			{
				m_pCacheDerived = new CuDlgDbmsCacheDerived (pTab);
				m_pCacheDerived->Create (IDD_DBMS_PAGE_CACHE_DERIVED, pTab);
			}
			m_pCurrentPage = m_pCacheDerived;
			break;
		default:
			break;
		}
		if (m_pCurrentPage) 
		{
			CRect r;
			pTab->GetClientRect (r);
			pTab->AdjustRect (FALSE, r);
			m_pCurrentPage->SendMessage (WMUSRMSG_CBF_PAGE_UPDATING, 0, 0);
			m_pCurrentPage->MoveWindow(r);
			m_pCurrentPage->ShowWindow(SW_SHOW);
		}
	}
	catch (CeVcbfException e)
	{
		//
		// Catch critical error 
		TRACE1 ("CuDlgCacheTab::DisplayPage has caught exception: %s\n", e.m_strReason);
		CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
		pMain->CloseApplication (FALSE);
	}
	catch (CMemoryException* e)
	{
		VCBF_OutOfMemoryMessage ();
		e->Delete();
	}
	catch (...)
	{
		TRACE0 ("Other error occured ...\n");
	}
}
Beispiel #3
1
BOOL CMainTabDlg::OnInitDialog() 
{
	CRect   r;
	TC_ITEM item;
	CString strTab;
	UINT nTabID[3]= {IDS_TAB_MAIN_CONFIGURE,IDS_TAB_MAIN_HISTORY,IDS_TAB_MAIN_PREFERENCES};
	CDialog::OnInitDialog();
	memset (&item, 0, sizeof (item));
	item.mask       = TCIF_TEXT|TCIF_IMAGE;
	item.cchTextMax = 32;
	item.iImage     = -1;
	CTabCtrl * ptab = (CTabCtrl * )GetDlgItem(IDC_TAB1);
	ASSERT(ptab);

	ptab->GetWindowRect (r);
	ScreenToClient (r);
	m_dlgPadding.cx = r.left;
	m_dlgPadding.cy = r.top;

	CButton* pButton1= (CButton*)GetDlgItem(IDC_BUTTON1);
	ASSERT (pButton1);
	pButton1->GetWindowRect (r);
	ScreenToClient (r);
	m_buttonPadding.cx = r.right;
	m_buttonPadding.cy = r.bottom;
	int nTab = 2;
#if defined (OIDSK)
	nTab = 2;
#endif
	for (int i=0; i<nTab; i++)  {
		strTab.LoadString (nTabID [i]);
		item.pszText = (LPTSTR)(LPCTSTR)strTab;
		ptab->InsertItem (i, &item);
	}
	if (m_pCurDlg)
		m_pCurDlg->ShowWindow (SW_HIDE);
	CTabCtrl* pTab = (CTabCtrl*) GetDlgItem(IDC_TAB1);
	int nsel = pTab->GetCurSel();
	switch (nsel) 
	{
	case PANE_CONFIG:
		if (!m_pConfigDlg)
		{
			m_pConfigDlg = new CConfigDlg(pTab);
			m_pConfigDlg->Create(IDD_CONFIG,pTab);
		}
		m_pCurDlg= m_pConfigDlg;
		break;
	case PANE_HISTORY:
		if (!m_pHistDlg)
		{
			m_pHistDlg = new CHistDlg(pTab);
			m_pHistDlg->Create(IDD_HISTORY,pTab);
		}
		m_pCurDlg= m_pHistDlg;
		break;
	case PANE_PREFERENCES:
		if (!m_pPrefDlg)
		{
			m_pPrefDlg = new CPrefDlg(pTab);
			m_pPrefDlg->Create(IDD_PREFERENCES,pTab);
		}
		m_pCurDlg= m_pPrefDlg;
		break;
	} 

	if (m_pCurDlg) 
	{
		CRect r;
		pTab->GetClientRect (r);
		pTab->AdjustRect (FALSE, r);
		m_pCurDlg->MoveWindow(r);
		m_pCurDlg->ShowWindow(SW_SHOW);
	}
	SHOSTINFO CurInfo;
	
	VCBFGetHostInfos(&CurInfo);
	CStatic* pStatic = (CStatic*)GetDlgItem(IDC_STATIC_NAME_INSTALL);
	pStatic->SetWindowText((LPCTSTR)CurInfo.ii_installation_name);
	
	pStatic = (CStatic*)GetDlgItem(IDC_STATIC_INSTALL);
	pStatic->SetWindowText((LPCTSTR)CurInfo.ii_installation);
	
	
	pStatic = (CStatic*)GetDlgItem(IDC_STATIC_IISYSTEM_NAME);
	pStatic->SetWindowText((LPCTSTR)CurInfo.ii_system_name);
	
	pStatic = (CStatic*)GetDlgItem(IDC_STATIC_II_SYSTEM);
	pStatic->SetWindowText((LPCTSTR)CurInfo.ii_system);
	
	pStatic = (CStatic*)GetDlgItem(IDC_STATIC_HOST);
	pStatic->SetWindowText((LPCTSTR)CurInfo.host);


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #4
1
void CMainTabDlg::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	CTabCtrl * pTab = (CTabCtrl *) GetDlgItem(IDC_TAB1);
	CRect rDlg;

	GetClientRect (rDlg);
	if (pTab && IsWindow(pTab->m_hWnd)) 
	{
		//
		// Move the buttons to the right place.
		CButton* pB1 = (CButton*) GetDlgItem(IDC_BUTTON2); // Close;
		CButton* pB2 = (CButton*) GetDlgItem(IDC_BUTTON1); // Help
		CButton* pB3 = (CButton*) GetDlgItem(IDC_BUTTON3);
		
		int   ibY = 0;
		CRect r, newRect;
		pB1->GetClientRect (r);
		newRect.top    = rDlg.bottom - 10 - r.Height();
		newRect.right  = rDlg.right  - m_dlgPadding.cx;
		newRect.left   = newRect.right - r.Width();
		newRect.bottom = newRect.top + r.Height();
		pB1->MoveWindow (newRect);

		newRect.right  = newRect.left - 10;
		newRect.left   = newRect.right - r.Width();
		pB2->MoveWindow (newRect);

		newRect.right  = newRect.left - 10;
		newRect.left   = newRect.right - r.Width();
		pB3->MoveWindow (newRect);
		ibY = newRect.top;

		//
		// Move the static Text Header II_SYSTEM 
		// to the right place.
		CStatic* pStatic = (CStatic*)GetDlgItem(IDC_STATIC_II_SYSTEM);
		pStatic->GetWindowRect (r);
		ScreenToClient (r);
		r.right   = rDlg.right  - m_dlgPadding.cx;
		pStatic->MoveWindow (r);


		//
		// Move the Tab Control to the right place.
		pStatic->GetWindowRect (r);
		ScreenToClient (r);

		r.top     = r.bottom + 10;
		r.bottom  = ibY - 10;
		r.left    = m_dlgPadding.cx;
		r.right   = rDlg.right -  m_dlgPadding.cx;
		pTab->MoveWindow(r);
		if (m_pCurDlg) 
		{
			CRect r;
			pTab->GetClientRect (r);
			pTab->AdjustRect (FALSE, r);
			m_pCurDlg->MoveWindow(r);
		}
	}
}
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;
}
Beispiel #6
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);
}
Beispiel #7
0
void CMainTabDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if (m_pCurDlg) 
	{
		//
		// Try to save (and validate) the data that has been changed
		// in the old page before displaying a new page.
		m_pCurDlg->SendMessage(WMUSRMSG_CBF_PAGE_VALIDATE, (WPARAM)0, (LPARAM)0);
		m_pCurDlg->ShowWindow(SW_HIDE);
		m_pCurDlg->SendMessage (WM_COMPONENT_EXIT, 0, 0);
		m_pCurDlg = NULL;
	}
	
	CTabCtrl* pTab = (CTabCtrl*) GetDlgItem(IDC_TAB1);
	int nsel = pTab->GetCurSel();
	
	switch (nsel) 
	{
	case  PANE_CONFIG:
		if (!m_pConfigDlg)
		{
			m_pConfigDlg = new CConfigDlg(pTab);
			m_pConfigDlg->Create(IDD_CONFIG,pTab);
		}
		m_pCurDlg= m_pConfigDlg;
		break;
	case PANE_HISTORY:
		if (!m_pHistDlg)
		{
			m_pHistDlg = new CHistDlg(pTab);
			m_pHistDlg->Create(IDD_HISTORY,pTab);
		}
		m_pCurDlg= m_pHistDlg;
		break;
	case PANE_PREFERENCES:
		if (!m_pPrefDlg)
		{
			m_pPrefDlg = new CPrefDlg(pTab);
			m_pPrefDlg->Create(IDD_PREFERENCES,pTab);
		}
		m_pCurDlg= m_pPrefDlg;
		break;
	} 
	
	if (m_pCurDlg) 
	{
		CRect r;
		pTab->GetClientRect (r);
		pTab->AdjustRect (FALSE, r);
		m_pCurDlg->MoveWindow(r);
		m_pCurDlg->ShowWindow(SW_SHOW);
		m_pCurDlg->SendMessage(WMUSRMSG_CBF_PAGE_UPDATING, 0, 0);
		m_pCurDlg->SendMessage(WM_COMPONENT_ENTER, 0, 0);
	}
}
BOOL CResizableSheet::ArrangeLayoutCallback(LAYOUTINFO &layout) const
{
	if (layout.nCallbackID != m_nCallbackID)	// we only added 1 callback
		return CResizableLayout::ArrangeLayoutCallback(layout);

	// set layout info for active page
	layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0);
	if (!::IsWindow(layout.hWnd))
		return FALSE;

	// set margins
	if (IsWizard())	// wizard mode
	{
		// use pre-calculated margins
		layout.marginTopLeft = m_sizePageTL;
		layout.marginBottomRight = m_sizePageBR;
	}
	else	// tab mode
	{
		CTabCtrl* pTab = GetTabControl();
		ASSERT(pTab != NULL);

		// get tab position after resizing and calc page rect
		CRect rectPage, rectSheet;
		GetTotalClientRect(&rectSheet);

		if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage))
			return FALSE; // no page yet

		// temporarily resize the tab control to calc page size
		CRect rectSave;
		pTab->GetWindowRect(rectSave);
		::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2);
		pTab->SetRedraw(FALSE);
		pTab->MoveWindow(rectPage, FALSE);
		pTab->AdjustRect(FALSE, &rectPage);
		pTab->MoveWindow(rectSave, FALSE);
		pTab->SetRedraw(TRUE);

		// set margins
		layout.marginTopLeft = rectPage.TopLeft() - rectSheet.TopLeft();
		layout.marginBottomRight = rectPage.BottomRight() - rectSheet.BottomRight();
	}

	// set anchor types
	layout.anchorTopLeft = TOP_LEFT;
	layout.anchorBottomRight = BOTTOM_RIGHT;

	// use this layout info
	return TRUE;
}
Beispiel #9
0
void CuDlgCacheTab::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);
	CTabCtrl* pTab = (CTabCtrl*)GetDlgItem (IDC_TAB1);
	if (!(pTab && IsWindow (pTab->m_hWnd)))
		return;
	CRect rDlg, r;
	GetClientRect (rDlg);
	pTab->MoveWindow (rDlg);
	if (!m_pCurrentPage) 
		return;
	pTab->GetClientRect (r);
	pTab->AdjustRect (FALSE, r);
	m_pCurrentPage->MoveWindow(r);
	m_pCurrentPage->ShowWindow(SW_SHOW);
}
BOOL CResizableSheetEx::CalcSizeExtra(HWND /*hWndChild*/, CSize sizeChild, CSize &sizeExtra)
{
	CTabCtrl* pTab = GetTabControl();
	if (!pTab)
		return FALSE;

	// get margins of tabcontrol
	CRect rectMargins;
	if (!GetAnchorMargins(pTab->m_hWnd, sizeChild, rectMargins))
		return FALSE;

	// get margin caused by tabcontrol
	CRect rectTabMargins(0,0,0,0);

	// get tab position after resizing and calc page rect
	CRect rectPage, rectSheet;
	GetTotalClientRect(&rectSheet);

	if (!GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage))
		return FALSE; // no page yet

	// temporarily resize the tab control to calc page size
	CRect rectSave;
	pTab->GetWindowRect(rectSave);
	::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectSave, 2);
	pTab->SetRedraw(FALSE);
	pTab->MoveWindow(rectPage, FALSE);
	pTab->AdjustRect(TRUE, &rectTabMargins);
	pTab->MoveWindow(rectSave, FALSE);
	pTab->SetRedraw(TRUE);

	// add non-client size
	::AdjustWindowRectEx(&rectTabMargins, GetStyle(), !(GetStyle() & WS_CHILD) &&
		::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());

	// compute extra size
	sizeExtra = rectMargins.TopLeft() + rectMargins.BottomRight() +
		rectTabMargins.Size();
	return TRUE;
}
BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout)
{
	if (layout.nCallbackID != 1)	// we only added 1 callback
		return CResizableLayout::ArrangeLayoutCallback(layout);

	// set layout info for active page
	layout.hWnd = GetActivePage()->GetSafeHwnd();

	// set margins
	if (IsWizard())	// wizard mode
	{
		// use pre-calculated margins
		layout.sizeMarginTL = m_sizePageTL;
		layout.sizeMarginBR = m_sizePageBR;
	}
	else	// tab mode
	{
		CRect rectPage, rectSheet;
		GetTotalClientRect(&rectSheet);

		CTabCtrl* pTab = GetTabControl();
		pTab->GetWindowRect(&rectPage);
		pTab->AdjustRect(FALSE, &rectPage);
		ScreenToClient(&rectPage);

		// use tab control
		layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
		layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
	}

	// set anchor types
	layout.sizeTypeTL = TOP_LEFT;
	layout.sizeTypeBR = BOTTOM_RIGHT;

	// use this layout info
	return TRUE;
}
Beispiel #12
0
void CComPropertySheet::OnActivated(CPropertyPage* pPage)
{
	if(!pPage) return;

	CRect bounds(30000,30000,-30000,-30000);

	CRect wr, cr;
	GetWindowRect(wr);
	GetClientRect(cr);
	CSize ws = wr.Size(), cs = cr.Size();

	CRect twr, tcr;
	CTabCtrl* pTC = (CTabCtrl*)GetDlgItem(AFX_IDC_TAB_CONTROL);
	pTC->GetWindowRect(twr);
	pTC->GetClientRect(tcr);
	CSize tws = twr.Size(), tcs = tcr.Size();

	if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
	{
		pChild->ModifyStyle(WS_CAPTION|WS_THICKFRAME, 0);
		pChild->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);

		for(CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow())
		{
			if(!(pGrandChild->GetStyle()&WS_VISIBLE)) continue;

			CRect r;
			pGrandChild->GetWindowRect(&r);
			pChild->ScreenToClient(r);
			bounds |= r;
		}
	}

	bounds |= CRect(0,0,0,0);
	bounds.SetRect(0, 0, bounds.right + max(bounds.left, 4), bounds.bottom + max(bounds.top, 4));

	CRect r = CRect(CPoint(0,0), bounds.Size());
	pTC->AdjustRect(TRUE, r);
	r.SetRect(twr.TopLeft(), twr.TopLeft() + r.Size());
	ScreenToClient(r);
	pTC->MoveWindow(r);
	pTC->ModifyStyle(TCS_MULTILINE, TCS_SINGLELINE);

	CSize diff = r.Size() - tws;

	if(!bounds.IsRectEmpty())
	{
		if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
			pChild->MoveWindow(bounds);
		CRect r = twr;
		pTC->AdjustRect(FALSE, r);
		ScreenToClient(r);
		pPage->MoveWindow(CRect(r.TopLeft(), bounds.Size()));
	}

	int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
	for(int i = 0; i < countof(_afxPropSheetButtons); i++)
	{
		if(CWnd* pWnd = GetDlgItem(_afxPropSheetButtons[i]))
		{
			pWnd->GetWindowRect(r);
			ScreenToClient(r);
			pWnd->MoveWindow(CRect(r.TopLeft() + diff, r.Size()));
		}
	}

	MoveWindow(CRect(wr.TopLeft(), ws + diff));

	Invalidate();
}
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);   
	}
}