Thursday 18 August 2011

How to restrict resizing a window

We want to allow user to resize dialog up to certain minimum/maximum dimensions. This can be done by overloading CWnd::OnGetMinMaxInfo in your class. This method is WM_GETMINMAXINFO message handler in which you can set window's maximum and minimum size. This applies to any class derived from CWnd (so including classes derived from CDialog, CFrameWnd, CFormView...).

Links and references:

How to set the Minimum and Maximum window size while Resizing?
Control client area minimum size with MFC
MFC General: How to prevent a resizable window to be smaller than...?

No comments: