How to restrict user to reduce size of dialog box
-
Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below
void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box }
But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravi -
Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below
void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box }
But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravi-Sarath. The more you can dream the more you can do - Michael Korda"
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below
void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box }
But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravisravishankar wrote:
I want to restrict user not to reduce the size of dialog within limits.
That's what
OnGetMinMaxInfo()
is for. There is an example of it here (in the Extras section).
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb