xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.

◆ anchor() [1/2]

virtual anchor_styles xtd::forms::control::anchor ( ) const

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

A bitwise combination of the anchor_styles values. The default is top and left.
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.
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.