I am using MFC and C++...
I have a dialog of type CDialog containing several objects including a CPropertySheet called m_dlgPropSheet (which does not have it's own class beyond CPropertySheet). This property sheet contains three identical pages (with different data) of type CPatchSummaryPage which inherits from CPropertyPage.
I am trying to make the dialog resizable. I have a textbox on each page which appears to be resizing fine and maintaining that size, but the size of the page itself is somewhat off and reverts to it's original size whenever you switch tabs.
The following is my code in the dialog:
(IDC_PROPSHEET is the placeholder for the property sheet in the mfc design editor.)
void CAboutDlg::OnSize(UINT nType, int cx, int cy)
{
if ( m_initialized && nType == SIZE_RESTORED) // When is resized by hand
{
CRect rcSheet;
CRect rcDialog;
this->GetDlgItem( IDC_PROPSHEET )->ShowWindow( SW_HIDE );
this->GetDlgItem( IDC_PROPSHEET )->GetWindowRect( &rcSheet );
this->GetWindowRect( &rcDialog );
CPoint point;
point = rcDialog.BottomRight();
point.x -= 30;
point.y -= 30;
rcSheet.SetRect(rcSheet.TopLeft(), point);
ScreenToClient( &rcSheet );
this->GetDlgItem( IDC_PROPSHEET )->MoveWindow( &rcSheet );
this->GetDlgItem( IDC_PROPSHEET )->ShowWindow( SW_SHOW );
m_dlgPropSheet.MoveWindow( &rcSheet );
m_consolePage.ResizePage( rcSheet );
m_databasePage.ResizePage( rcSheet );
m_coreServicesPage.ResizePage( rcSheet );
}
CDialog::OnSize(nType, cx, cy);
}
The following is my code inside CPatchSummaryPage:
void CPatchSummaryPage::ResizePage(CRect rcSheet)
{
SetWindowPos(NULL, 0, 0, rcSheet.Width()-14, rcSheet.Height(), SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
CRect rcDetails;
m_detailsText.GetWindowRect( &rcDetails );
m_detailsText.SetWindowPos(NULL, 0, 0, rcSheet.Width()-14, rcDetails.Height(), SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
Thanks in advance!