Click or drag to resize

ControlSetAnchor Method

Sets the anchor identified by margin constant from Margin enum to value anchor. A setter method for AnchorBottom, AnchorLeft, AnchorRight and AnchorTop.

If keep_margin is true, margins aren't updated after this operation.

If push_opposite_anchor is true and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If push_opposite_anchor was false, the left anchor would get value 0.5.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public void SetAnchor(
	Margin margin,
	float anchor,
	bool keepMargin = false,
	bool pushOppositeAnchor = true
)

Parameters

margin
Type: GodotMargin

[Missing <param name="margin"/> documentation for "M:Godot.Control.SetAnchor(Godot.Margin,System.Single,System.Boolean,System.Boolean)"]

anchor
Type: SystemSingle

[Missing <param name="anchor"/> documentation for "M:Godot.Control.SetAnchor(Godot.Margin,System.Single,System.Boolean,System.Boolean)"]

keepMargin (Optional)
Type: SystemBoolean

[Missing <param name="keepMargin"/> documentation for "M:Godot.Control.SetAnchor(Godot.Margin,System.Single,System.Boolean,System.Boolean)"]

pushOppositeAnchor (Optional)
Type: SystemBoolean

[Missing <param name="pushOppositeAnchor"/> documentation for "M:Godot.Control.SetAnchor(Godot.Margin,System.Single,System.Boolean,System.Boolean)"]

See Also