A set of functions in Win32API can be used (simultaneously) to adjust the size and location of multiple sub-controls in a form. Here is an example I use this set of API to adjust a control, which is equally possible for multiple controls. Rect rcl; // acquire the entire form client area rectangular HDWP HDWP; // Use to store location information of multiple subforms (controls)
// Get the client isa of the parent window. GetClientRect (_HDLG, & RCL); // _hdlg is my form handle
// We will be deferring Four Windows. HDWP = BegindeferWindowPos (1); // Create a structure, parameter 1 tells it that I will adjust a child form location
// Adjust my control position and size, in fact I am making this control to fill the entire form. Swp_nomove represents the location constant DEFERWINDOWPOS (HDWP, Hbrowser, Null, 0, 0, Rcl.right - rcl.left, Rcl.Bottom - Rcl.top, SWP_NOZORDER | SWP_NOMOVE); / / For other controls that need to be adjusted, it will be called / * DeferWindowPos (HDWP, G_LISTING.HWNDLISTVIEW, NULL, LEFT, TOP, WIDTH, HEIGHT, SWP_NOZORDER); * /
EnddeferWindowPOS (HDWP); // Finally, the new location and size of each form