mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
116 lines
4.0 KiB
ReStructuredText
116 lines
4.0 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_GridContainer:
|
|
|
|
GridContainer
|
|
=============
|
|
|
|
**繼承:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
將子控制項按照網格佈局排列的容器。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
說明
|
|
----
|
|
|
|
**GridContainer** 會將其子控制項按照網格佈局排列。網格的列數由 :ref:`columns<class_GridContainer_property_columns>` 屬性指定,行數取決於容器中子控制項的數量。將保留每個大小的容器的列和行。
|
|
|
|
\ **注意:**\ **GridContainer** 只對繼承自 :ref:`Control<class_Control>` 的子節點生效。它不會重新排列繼承自 :ref:`Node2D<class_Node2D>` 的子節點。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
教學
|
|
----
|
|
|
|
- :doc:`使用容器 <../tutorials/ui/gui_containers>`
|
|
|
|
- `Operating System Testing Demo <https://godotengine.org/asset-library/asset/2789>`__
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
屬性
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------+------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`columns<class_GridContainer_property_columns>` | ``1`` |
|
|
+-----------------------+------------------------------------------------------+-------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
主題屬性
|
|
--------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------+----------------------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`h_separation<class_GridContainer_theme_constant_h_separation>` | ``4`` |
|
|
+-----------------------+----------------------------------------------------------------------+-------+
|
|
| :ref:`int<class_int>` | :ref:`v_separation<class_GridContainer_theme_constant_v_separation>` | ``4`` |
|
|
+-----------------------+----------------------------------------------------------------------+-------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
屬性說明
|
|
--------
|
|
|
|
.. _class_GridContainer_property_columns:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **columns** = ``1`` :ref:`🔗<class_GridContainer_property_columns>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_columns**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_columns**\ (\ )
|
|
|
|
**GridContainer** 中的列數。修改後,\ **GridContainer** 會重新排列其衍生自 Control 的子節點,以適應新的佈局。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
主題屬性說明
|
|
------------
|
|
|
|
.. _class_GridContainer_theme_constant_h_separation:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`int<class_int>` **h_separation** = ``4`` :ref:`🔗<class_GridContainer_theme_constant_h_separation>`
|
|
|
|
The horizontal separation of child nodes.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GridContainer_theme_constant_v_separation:
|
|
|
|
.. rst-class:: classref-themeproperty
|
|
|
|
:ref:`int<class_int>` **v_separation** = ``4`` :ref:`🔗<class_GridContainer_theme_constant_v_separation>`
|
|
|
|
The vertical separation of child nodes.
|
|
|
|
.. |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 (無回傳值。)`
|