|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Eric Houvenaghel
|
Sep 20, 2006 - 8:27 AM
|
Hi,
I need to resize a dialog to a smaller size than its resource. I use this dialog in two cases, one with the original resource size, the other with smaller size with some controls that i hide or move.
Without Prof-UIS controls, resizing a dialog to a bigger or a smaller size is working. With Prof-UIS, resizing to a bigger size is working (and so your CExtResizableDialog::EnableSaveRestore() function is working well), but resizing to a smaller size make nothing: the dialog has the size of its original resource.
I think maybe you have made some protection to prevent from resizing smaller in a kind of CExtXXXImpl object! How can i correct my problem?
Here is a small code part of the problem:
BOOL DlgNames::OnInitDialog()
{
CExtResizableDialog::OnInitDialog();
HICON hIcon = AfxGetApp()->LoadIcon(RPROD_MAINFRAME);
SetIcon(hIcon, TRUE);
SetIcon(hIcon, FALSE);
if (m_SmallMode) {
// Hide some controls we don’t need in small mode.
m_ButtonAdd.ShowWindow(SW_HIDE);
// Move the OK button to be display in small mode.
CRect rectPlaceOK;
GetDlgItem(RNOTES_IDC_FRAME_OK)->GetWindowRect(&rectPlaceOK);
ScreenToClient(&rectPlaceOK);
m_ButtonOK.MoveWindow(&rectPlaceOK);
// Resize the dialog - smaller size.
WINDOWPLACEMENT WindowPlacement;
::ZeroMemory(&WindowPlacement, sizeof(WINDOWPLACEMENT));
WindowPlacement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(&WindowPlacement);
RECT& rc = WindowPlacement.rcNormalPosition;
rc.right = rc.left + 280;
rc.bottom = rc.top + 310;
SetWindowPlacement(&WindowPlacement);
RedrawWindow(NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW |RDW_ALLCHILDREN|RDW_FRAME); // <-- With or without this line, the dialog still unrezise!
// Anchor the controls (do it after having resize the dialog).
AddAnchor(m_ButtonOK, __RDA_XY);
// Enable dialog position save/restore.
EnableSaveRestore(__PROF_UIS_PROJECT_DLG_PERSIST_REG_KEY, _T("DlgNames-SmallMode-Saved-Position")); // <-- Use a specific Entry name.
}
else { // Not in small mode
// No hide, no resize.
// Anchor the controls.
AddAnchor(m_ButtonAdd, CSize(50, 0));
AddAnchor(m_ButtonOK, __RDA_XY);
// Enable dialog position save/restore.
EnableSaveRestore(__PROF_UIS_PROJECT_DLG_PERSIST_REG_KEY, _T("DlgNames-Saved-Position")); // <-- Use a specific Entry name.
}
return TRUE;
}
Thanks
|
|
Technical Support
|
Sep 21, 2006 - 5:55 AM
|
The CExtResizableDialog class is derived from the CExtWA template class. So, you can use the CExtWA::SetMinTrackSize() method to specify any minimum size.
|
|