void CExportDlg::RepositionControls () { // // Reposition the controls // RepositionControl (m_cbExportStyle, cmb1, true); RepositionControl (m_statExportStyle, stc2, false); RepositionControl (m_cbDebugStyle, cmb1, true); RepositionControl (m_statDebugStyle, stc2, false); }
// If there is no headline text hide the control and move the main text up void CWSMessageBox::HideHeadLineText(void) { if(m_sHeadlineText.IsEmpty()) { RECT HeadlineRect, MainRect; GetDlgItem(IDC_HEADLINE_TEXT)->GetWindowRect(&HeadlineRect); GetDlgItem(IDC_MAIN_TEXT)->GetWindowRect(&MainRect); GetDlgItem(IDC_HEADLINE_TEXT)->ShowWindow(SW_HIDE); // Move up the main text control // FIXME MINIMUM HERE!!! RepositionControl(m_hWnd, IDC_MAIN_TEXT, HeadlineRect.top - MainRect.top); } }
void CWSMessageBox::AdjustDialogHeight(void) { int iControlHeightChange = ScaleTextControl(IDC_HEADLINE_TEXT, m_sHeadlineText); iControlHeightChange += ScaleTextControl(IDC_MAIN_TEXT, m_sMainText); UpdateData(FALSE);//In case CalcHeightNeededTextCtrl() had to chop up a very long word. CRect ClientRect; m_MainTextCtrl.GetClientRect(&ClientRect); // Resize the dialog RECT r; GetWindowRect(&r); int iNewHeight = (r.bottom - r.top) + iControlHeightChange; SetWindowPos(0, 0, 0, (r.right - r.left), iNewHeight, SWP_NOMOVE | SWP_NOZORDER); // Now reposition all the other controls below it RepositionControl(m_hWnd, IDC_CHECK_DO_NOT_SHOW, iControlHeightChange); RepositionControl(m_hWnd, IDC_BUTTON1, iControlHeightChange); RepositionControl(m_hWnd, IDC_BUTTON2, iControlHeightChange); RepositionControl(m_hWnd, IDC_BUTTON3, iControlHeightChange); RepositionControl(m_hWnd, IDC_HELPLINK, iControlHeightChange); RepositionControl(m_hWnd, IDC_SEPARATOR, iControlHeightChange); }