MFC/C++ dynamic resizing in dialog which is child of another dialog?

Viewed 402

I have a C++/MFC dialog, A, which I have enabled dynamic layout for several controls via the Resource Editor in Visual Studio 2019. This works with no problem. When I build and run A, the selected controls resize and move as I specified.

Dialog A "contains" dialog B, for which I have also enabled dynamic layout using the Resource Editor. By "contains", I mean the dialog class for B is a member variable of A. my code moves the window of B to the desired position in A (to the user, it looks like A and B are a single dialog, as B has no border).

The difficulty I am having is this: when the user resizes A by dragging on its edge, I need dialog B to also resize. I handle this by getting the notification OnSize (WM_SIZE) or OnSizing (WM_SIZING) from A, and then resizing B using MoveWindow. B then receives a WM_SIZE message and its size is changed, but B does not do its dynamic resizing. How can I get B to do the dynamic resizing programmatically?

I saw the technique of setting dynamic layout programmatically for each control, but I want to use the values I set in the Resource Editor for B. Is there a way to do this?

0 Answers
Related