|
gadget - gadget whose layout rules to set left - rule for the left edge right - rule for the right edge top - rule for the top edge bottom - rule for the bottom edge Each edge rule is one of: 0: unchanged - the gadget keeps its size on that axis and drifts with the group's centre 1: anchored - the edge keeps a fixed distance from the matching group edge 2: proportional - the edge moves in proportion to the group's new size |
|
Sets how a gadget's edges follow its group when the group is resized. Gadgets default to 0,0,0,0: they keep their size but drift proportionally with their group's centre when it is resized. Set explicit rules to keep controls anchored or stretch them with the window (or panel, group box, splitter pane, tabber page). The classic recipes: SetGadgetLayout toolbar,1,1,1,0 - stick to the top, stretch across SetGadgetLayout mainView,1,1,1,1 - fill and stretch with the window SetGadgetLayout okButton,0,1,0,1 - hug the bottom-right corner, fixed size Rule 1 anchors an edge at its current distance from the same edge of the group: left/top anchor to the group's left/top, right/bottom to its right/bottom. Rule 2 keeps the edge at the same proportional position. Rule 0 keeps the gadget's size on that axis; with both edges 0 it drifts to stay centred. The rules take the gadget's current shape and the group's current client size as their baseline - and calling SetGadgetShape re-baselines them - so set the shape first, then the layout. Everything is measured in 96-DPI logical pixels; the GUI scales for the monitor itself. See it working in the layout and controls sample. See also: SetGadgetShape, ClientWidth, ClientHeight, SetMinWindowSize, CreateWindow. |