Files
godot-docs-l10n/classes/zh_Hant/class_margincontainer.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

136 lines
5.1 KiB
ReStructuredText

:github_url: hide
.. meta::
:keywords: padding
.. _class_MarginContainer:
MarginContainer
===============
**繼承:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**被繼承:** :ref:`EditorDock<class_EditorDock>`
在子控制項周圍保留邊距的容器。
.. rst-class:: classref-introduction-group
說明
----
**MarginContainer** 會為子控制項的各條邊加上可調整的邊距。是在所有子項周圍新增邊距,而不是在它們各自周圍新增邊距。要控制 **MarginContainer** 的邊距,請使用下列 ``margin_*`` 主題屬性。
\ **注意:**\ 邊距大小是主題覆蓋項,而不是普通的屬性。如果想要通過程式碼更改,應使用以下範例:
.. tabs::
.. code-tab:: gdscript
# 這段程式碼範例要求目前腳本擴充的是 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)
.. code-tab:: csharp
// 這段程式碼範例要求目前腳本擴充的是 MarginContainer。
int marginValue = 100;
AddThemeConstantOverride("margin_top", marginValue);
AddThemeConstantOverride("margin_left", marginValue);
AddThemeConstantOverride("margin_bottom", marginValue);
AddThemeConstantOverride("margin_right", marginValue);
.. rst-class:: classref-introduction-group
教學
----
- :doc:`使用容器 <../tutorials/ui/gui_containers>`
.. rst-class:: classref-reftable-group
主題屬性
--------
.. table::
:widths: auto
+-----------------------+--------------------------------------------------------------------------+-------+
| :ref:`int<class_int>` | :ref:`margin_bottom<class_MarginContainer_theme_constant_margin_bottom>` | ``0`` |
+-----------------------+--------------------------------------------------------------------------+-------+
| :ref:`int<class_int>` | :ref:`margin_left<class_MarginContainer_theme_constant_margin_left>` | ``0`` |
+-----------------------+--------------------------------------------------------------------------+-------+
| :ref:`int<class_int>` | :ref:`margin_right<class_MarginContainer_theme_constant_margin_right>` | ``0`` |
+-----------------------+--------------------------------------------------------------------------+-------+
| :ref:`int<class_int>` | :ref:`margin_top<class_MarginContainer_theme_constant_margin_top>` | ``0`` |
+-----------------------+--------------------------------------------------------------------------+-------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
主題屬性說明
------------
.. _class_MarginContainer_theme_constant_margin_bottom:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **margin_bottom** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_bottom>`
Offsets towards the inside direct children of the container by this amount of pixels from the bottom.
.. rst-class:: classref-item-separator
----
.. _class_MarginContainer_theme_constant_margin_left:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **margin_left** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_left>`
Offsets towards the inside direct children of the container by this amount of pixels from the left.
.. rst-class:: classref-item-separator
----
.. _class_MarginContainer_theme_constant_margin_right:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **margin_right** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_right>`
Offsets towards the inside direct children of the container by this amount of pixels from the right.
.. rst-class:: classref-item-separator
----
.. _class_MarginContainer_theme_constant_margin_top:
.. rst-class:: classref-themeproperty
:ref:`int<class_int>` **margin_top** = ``0`` :ref:`🔗<class_MarginContainer_theme_constant_margin_top>`
Offsets towards the inside direct children of the container by this amount of pixels from the top.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`