OnSize method
-
Hi, I have a dialog in which I overloaded the OnSize method. I want to make my dialog to have some minimum dimensions so that the user couldn't resize the dialog past these dimensions. I've tried something like this but the dialog can be resized: MyDialog::OnSize (UINT nType, int cx, int cy) { if (cx < MyCx || cy < MyCy) // if the new cx is smaller than the minimum // MyCx there should be no resizing return; // normal resizing procedures... } Any ideas? Thanks. ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.
-
Hi, I have a dialog in which I overloaded the OnSize method. I want to make my dialog to have some minimum dimensions so that the user couldn't resize the dialog past these dimensions. I've tried something like this but the dialog can be resized: MyDialog::OnSize (UINT nType, int cx, int cy) { if (cx < MyCx || cy < MyCy) // if the new cx is smaller than the minimum // MyCx there should be no resizing return; // normal resizing procedures... } Any ideas? Thanks. ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.
Check out WM_GETMINMAXINFO - handling this message lets you set the minimum and maximum sizes of the dialog. Note that to get the message to appear in ClassWizard, you need to go to the Class Info tab, and set the Message Filter to "Window"