Click or drag to resize

Control.SetMarginsPreset Method

Sets the margins to a preset from Control.LayoutPreset enum. This is code equivalent of using the Layout menu in 2D editor.

Use parameter resize_mode with constants from Control.LayoutPresetMode to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. PRESET_LEFT_WIDE.

Use parameter margin to determine the gap between the Control and the edges.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public void SetMarginsPreset(
	Control.LayoutPreset preset,
	Control.LayoutPresetMode resizeMode = Control.LayoutPresetMode.Minsize,
	int margin = 0
)

Parameters

preset
Type: Godot.Control.LayoutPreset

[Missing <param name="preset"/> documentation for "M:Godot.Control.SetMarginsPreset(Godot.Control.LayoutPreset,Godot.Control.LayoutPresetMode,System.Int32)"]

resizeMode (Optional)
Type: Godot.Control.LayoutPresetMode

[Missing <param name="resizeMode"/> documentation for "M:Godot.Control.SetMarginsPreset(Godot.Control.LayoutPreset,Godot.Control.LayoutPresetMode,System.Int32)"]

margin (Optional)
Type: System.Int32

[Missing <param name="margin"/> documentation for "M:Godot.Control.SetMarginsPreset(Godot.Control.LayoutPreset,Godot.Control.LayoutPresetMode,System.Int32)"]

See Also