Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
MarginContainer
繼承: Container < Control < CanvasItem < Node < Object
被繼承: EditorDock
在子控制項周圍保留邊距的容器。
說明
MarginContainer 會為子控制項的各條邊加上可調整的邊距。是在所有子項周圍新增邊距,而不是在它們各自周圍新增邊距。要控制 MarginContainer 的邊距,請使用下列 margin_* 主題屬性。
注意:邊距大小是主題覆蓋項,而不是普通的屬性。如果想要通過程式碼更改,應使用以下範例:
# 這段程式碼範例要求目前腳本擴充的是 MarginContainer。
var margin_value = 100
add_theme_constant_override("margin_top", margin_value)
add_theme_constant_override("margin_left", margin_value)
add_theme_constant_override("margin_bottom", margin_value)
add_theme_constant_override("margin_right", margin_value)
// 這段程式碼範例要求目前腳本擴充的是 MarginContainer。
int marginValue = 100;
AddThemeConstantOverride("margin_top", marginValue);
AddThemeConstantOverride("margin_left", marginValue);
AddThemeConstantOverride("margin_bottom", marginValue);
AddThemeConstantOverride("margin_right", marginValue);
教學
主題屬性
|
||
|
||
|
||
|
主題屬性說明
Offsets towards the inside direct children of the container by this amount of pixels from the bottom.
Offsets towards the inside direct children of the container by this amount of pixels from the left.
Offsets towards the inside direct children of the container by this amount of pixels from the right.
Offsets towards the inside direct children of the container by this amount of pixels from the top.