xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.

§ anchor() [2/2]

virtual control& xtd::forms::control::anchor ( anchor_styles  anchor)
virtualinherited

Gets the edges of the container to which a control is bound and determines how a control is resized with its parent.

Parameters
anchorA bitwise combination of the anchor_styles values. The default is top and left.
Remarks
Use the anchor property to define how a control is automatically resized as its parent control is resized. Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resized.
You can anchor a control to one or more edges of its container. For example, if you have a form with a button whose anchor property value is set to top and bottom, the button is stretched to maintain the anchored distance to the top and bottom edges of the form as the height of the form is increased.
Note
The anchor and dock properties are mutually exclusive. Only one can be set at a time, and the last one set takes precedence.
Notes to Ineritors
When overriding the anchor property in a derived class, use the base class's anchor property to extend the base implementation. Otherwise, you must provide all the implementation. You are not required to override both the get and set accessors of the anchor property; you can override only one if needed.