Resizable WTL Layout

I would like to know how people with a lot of WTL knowledge will create something like this:

Dialog change (-> WS_THICKFRAME) containing two "areas". One area grows in the y direction when resizing and contains several components that should be located at the same distance from each other (for example, 0%, 25%, 50%, 75% and 100% of the height of the area).

The other area is lower and has a fixed height. When resizing, both areas should increase in the x-direction.

Important questions are: a) what containers, etc. use for these two areas b) how to handle resizing (DLGRESIZE_CONTROL does not allow spacing of a control with equal distance, for example, afaik)

Thank.

+3
source share
2 answers

This can be done using a splitter. Here is a great tutorial: http://www.codeproject.com/KB/wtl/wtl4mfc7.aspx

You can set SPLIT_BOTTOMALIGNED as an extended style to resize only the top panel (the bottom panel does not change).

+1
source

You can use a class for this CDialogResize. Just inherit from this class in the class the definition of your window and the definition of how to resize the control as a window is updated. These changes change the cascade, so you may have a window that resizes in one way, which also implements CDialogResize.

class CFooWindow : ... public CDialogResize<CFooWindow> {

    BEGIN_MSG_MAP(CFooWindow)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        ... more messages here
        CHAIN_MSG_MAP(CDialogResize<CFooWindow>)
    END_MSG_MAP()

    // This map defines how the controls within the window are resized.
    // You can also use DLGRESIZE_GROUP() to group controls together.
    BEGIN_DLGRESIZE_MAP(CFooWindow)
       DLGRESIZE_CONTROL(IDC_WINDOW_TOP,    DLSZ_SZIZE_X | DLSZ_SIZE_Y);
       DLGRESIZE_CONTROL(IDC_WINDOW_BOTTOM, DLSZ_SZIZE_X | DLSZ_MOVE_Y);
    END_DLGRESIZE_MAP()


    LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {

       DlgResize_Init();
    }
      .. the rest of your class here
}

, DLGRESIZE_GROUP() , , . . - , . CDlgResize::OnSize(UINT nType, int cx, int cy) .

+1

All Articles