Resizing Controls in MFC

前端 未结 8 1923
萌比男神i
萌比男神i 2021-01-11 10:26

I am writing a program which has two panes (via CSplitter), however I am having problems figuring out out to resize the controls in each frame. For simplicity,

8条回答
  •  迷失自我
    2021-01-11 10:50

    When it comes to the window size changes, there are three window messages you may be interested in: ON_WM_SIZE(), ON_WM_SIZING(), and ON_WM_GETMINMAXINFO().

    As the official docs says:

    • ON_WM_SIZE whose message handler is ::OnSize() is triggered after the size of the CWnd has changed;
    • ON_WM_SIZING whose message handler is ::OnSizing() is triggered when the size of the client area of the clipbord-viewer window has changed;
    • ON_WM_GETMINMAXINFO whose message handler is ::OnGetMinMaxInfo() is triggered whenever the window needs to know the maximized position or dimensions , or the minimum or maximum tracking size.

    If you want to restrict the size of the cwnd to some range, you may refer to message ON_WM_GETMINMAXINFO; and if you want to retrieve the size changes in real time, you may refer to the other two messages.

提交回复
热议问题