Files
godot-docs-l10n/classes/zh_Hant/class_styleboxflat.rst

668 lines
32 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_StyleBoxFlat:
StyleBoxFlat
============
**繼承:** :ref:`StyleBox<class_StyleBox>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
不使用紋理的自訂 :ref:`StyleBox<class_StyleBox>`\ 。
.. rst-class:: classref-introduction-group
說明
----
By configuring various properties of this style box, you can achieve many common looks without the need of a texture. This includes optionally rounded borders, antialiasing, shadows, and skew.
Setting corner radius to high values is allowed. As soon as corners overlap, the stylebox will switch to a relative system:
.. code:: text
height = 30
corner_radius_top_left = 50
corner_radius_bottom_left = 100
The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will **never** be more than the height. Result:
.. code:: text
corner_radius_top_left: 10
corner_radius_bottom_left: 20
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`bool<class_bool>` | :ref:`anti_aliasing<class_StyleBoxFlat_property_anti_aliasing>` | ``true`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`float<class_float>` | :ref:`anti_aliasing_size<class_StyleBoxFlat_property_anti_aliasing_size>` | ``1.0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | :ref:`bg_color<class_StyleBoxFlat_property_bg_color>` | ``Color(0.6, 0.6, 0.6, 1)`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`bool<class_bool>` | :ref:`border_blend<class_StyleBoxFlat_property_border_blend>` | ``false`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | :ref:`border_color<class_StyleBoxFlat_property_border_color>` | ``Color(0.8, 0.8, 0.8, 1)`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`border_width_bottom<class_StyleBoxFlat_property_border_width_bottom>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`border_width_left<class_StyleBoxFlat_property_border_width_left>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`border_width_right<class_StyleBoxFlat_property_border_width_right>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`border_width_top<class_StyleBoxFlat_property_border_width_top>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`corner_detail<class_StyleBoxFlat_property_corner_detail>` | ``8`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`corner_radius_bottom_left<class_StyleBoxFlat_property_corner_radius_bottom_left>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`corner_radius_bottom_right<class_StyleBoxFlat_property_corner_radius_bottom_right>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`corner_radius_top_left<class_StyleBoxFlat_property_corner_radius_top_left>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`corner_radius_top_right<class_StyleBoxFlat_property_corner_radius_top_right>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`bool<class_bool>` | :ref:`draw_center<class_StyleBoxFlat_property_draw_center>` | ``true`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`float<class_float>` | :ref:`expand_margin_bottom<class_StyleBoxFlat_property_expand_margin_bottom>` | ``0.0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`float<class_float>` | :ref:`expand_margin_left<class_StyleBoxFlat_property_expand_margin_left>` | ``0.0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`float<class_float>` | :ref:`expand_margin_right<class_StyleBoxFlat_property_expand_margin_right>` | ``0.0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`float<class_float>` | :ref:`expand_margin_top<class_StyleBoxFlat_property_expand_margin_top>` | ``0.0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`Color<class_Color>` | :ref:`shadow_color<class_StyleBoxFlat_property_shadow_color>` | ``Color(0, 0, 0, 0.6)`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`shadow_offset<class_StyleBoxFlat_property_shadow_offset>` | ``Vector2(0, 0)`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`int<class_int>` | :ref:`shadow_size<class_StyleBoxFlat_property_shadow_size>` | ``0`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`skew<class_StyleBoxFlat_property_skew>` | ``Vector2(0, 0)`` |
+-------------------------------+-------------------------------------------------------------------------------------------+-----------------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_border_width<class_StyleBoxFlat_method_get_border_width>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_border_width_min<class_StyleBoxFlat_method_get_border_width_min>`\ (\ ) |const| |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_corner_radius<class_StyleBoxFlat_method_get_corner_radius>`\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const| |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_expand_margin<class_StyleBoxFlat_method_get_expand_margin>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_border_width<class_StyleBoxFlat_method_set_border_width>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_border_width_all<class_StyleBoxFlat_method_set_border_width_all>`\ (\ width\: :ref:`int<class_int>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_corner_radius<class_StyleBoxFlat_method_set_corner_radius>`\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_corner_radius_all<class_StyleBoxFlat_method_set_corner_radius_all>`\ (\ radius\: :ref:`int<class_int>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_expand_margin<class_StyleBoxFlat_method_set_expand_margin>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_expand_margin_all<class_StyleBoxFlat_method_set_expand_margin_all>`\ (\ size\: :ref:`float<class_float>`\ ) |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_StyleBoxFlat_property_anti_aliasing:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **anti_aliasing** = ``true`` :ref:`🔗<class_StyleBoxFlat_property_anti_aliasing>`
.. rst-class:: classref-property-setget
- |void| **set_anti_aliased**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_anti_aliased**\ (\ )
抗鋸齒會在邊緣周圍繪製一個漸變到透明的小環。因此邊緣看起來會更加平滑。這僅在使用圓角或 :ref:`skew<class_StyleBoxFlat_property_skew>` 時才明顯。
\ **注意:**\ 使用 45 度倒角(\ :ref:`corner_detail<class_StyleBoxFlat_property_corner_detail>` = 1建議將 :ref:`anti_aliasing<class_StyleBoxFlat_property_anti_aliasing>` 設為 ``false``\ ,這樣可以保證畫面銳利、避免一些顯示問題。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_anti_aliasing_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **anti_aliasing_size** = ``1.0`` :ref:`🔗<class_StyleBoxFlat_property_anti_aliasing_size>`
.. rst-class:: classref-property-setget
- |void| **set_aa_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_aa_size**\ (\ )
修改抗鋸齒效果的大小。要在 100% 縮放時達到最佳效果推薦使用 ``1.0``\ ,和網頁流覽器以及大多數向量圖繪製軟體中圓角矩陣的繪製方式是一致的。
\ **注意:**\ 較高的值可能產生模糊效果,但框本身較小、圓角半徑較大的情況下也可能產生不理想的顯示問題。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_bg_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **bg_color** = ``Color(0.6, 0.6, 0.6, 1)`` :ref:`🔗<class_StyleBoxFlat_property_bg_color>`
.. rst-class:: classref-property-setget
- |void| **set_bg_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_bg_color**\ (\ )
StyleBox的背景顏色。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_blend:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **border_blend** = ``false`` :ref:`🔗<class_StyleBoxFlat_property_border_blend>`
.. rst-class:: classref-property-setget
- |void| **set_border_blend**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_border_blend**\ (\ )
如果為 ``true``\ ,邊框會淡入背景色。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **border_color** = ``Color(0.8, 0.8, 0.8, 1)`` :ref:`🔗<class_StyleBoxFlat_property_border_color>`
.. rst-class:: classref-property-setget
- |void| **set_border_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_border_color**\ (\ )
設定邊框的顏色。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_width_bottom:
.. rst-class:: classref-property
:ref:`int<class_int>` **border_width_bottom** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_border_width_bottom>`
.. rst-class:: classref-property-setget
- |void| **set_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
底邊框的寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_width_left:
.. rst-class:: classref-property
:ref:`int<class_int>` **border_width_left** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_border_width_left>`
.. rst-class:: classref-property-setget
- |void| **set_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
左邊框的寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_width_right:
.. rst-class:: classref-property
:ref:`int<class_int>` **border_width_right** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_border_width_right>`
.. rst-class:: classref-property-setget
- |void| **set_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
右邊框的寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_border_width_top:
.. rst-class:: classref-property
:ref:`int<class_int>` **border_width_top** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_border_width_top>`
.. rst-class:: classref-property-setget
- |void| **set_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
頂邊框的寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_corner_detail:
.. rst-class:: classref-property
:ref:`int<class_int>` **corner_detail** = ``8`` :ref:`🔗<class_StyleBoxFlat_property_corner_detail>`
.. rst-class:: classref-property-setget
- |void| **set_corner_detail**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_corner_detail**\ (\ )
設定用於每個角的頂點數。更高的值生成更圓的角,但需要更多的處理計算。選擇值時,應考慮角半徑(\ :ref:`set_corner_radius_all()<class_StyleBoxFlat_method_set_corner_radius_all>`\ )。
對於小於 10 的角半徑,\ ``4````5`` 應該就足夠。對於小於 30 的角半徑,\ ``8````12`` 之間的值應該足夠。
\ ``1``\ 的角細節會導致倒角而不是圓角,這對於某些藝術效果很有用。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_corner_radius_bottom_left:
.. rst-class:: classref-property
:ref:`int<class_int>` **corner_radius_bottom_left** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_corner_radius_bottom_left>`
.. rst-class:: classref-property-setget
- |void| **set_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const|
左下角的半徑。如果為 ``0``\ ,則該角不圓滑。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_corner_radius_bottom_right:
.. rst-class:: classref-property
:ref:`int<class_int>` **corner_radius_bottom_right** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_corner_radius_bottom_right>`
.. rst-class:: classref-property-setget
- |void| **set_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const|
右下角的半徑。如果為 ``0``\ ,則該角不圓滑。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_corner_radius_top_left:
.. rst-class:: classref-property
:ref:`int<class_int>` **corner_radius_top_left** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_corner_radius_top_left>`
.. rst-class:: classref-property-setget
- |void| **set_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const|
左上角的半徑。如果為 ``0``\ ,則該角不圓滑。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_corner_radius_top_right:
.. rst-class:: classref-property
:ref:`int<class_int>` **corner_radius_top_right** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_corner_radius_top_right>`
.. rst-class:: classref-property-setget
- |void| **set_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const|
右上角的半徑。如果為 ``0``\ ,則該角不圓滑。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_draw_center:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **draw_center** = ``true`` :ref:`🔗<class_StyleBoxFlat_property_draw_center>`
.. rst-class:: classref-property-setget
- |void| **set_draw_center**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_draw_center_enabled**\ (\ )
切換繪製 StyleBox 的內部部分。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_expand_margin_bottom:
.. rst-class:: classref-property
:ref:`float<class_float>` **expand_margin_bottom** = ``0.0`` :ref:`🔗<class_StyleBoxFlat_property_expand_margin_bottom>`
.. rst-class:: classref-property-setget
- |void| **set_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
將該樣式盒擴充到該控制項矩形的底邊。可以與 :ref:`border_width_bottom<class_StyleBoxFlat_property_border_width_bottom>` 組合,在該控制項矩形之外繪製邊框。
\ **注意:**\ 與 :ref:`StyleBox.content_margin_bottom<class_StyleBox_property_content_margin_bottom>` 不同,\ :ref:`expand_margin_bottom<class_StyleBoxFlat_property_expand_margin_bottom>` *並不會*\ 影響 :ref:`Control<class_Control>` 的可點擊區域。錯誤使用時會對可用性造成負面影響,因為使用者可能會點擊該 StyleBox 上實際無法接受點擊的區域。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_expand_margin_left:
.. rst-class:: classref-property
:ref:`float<class_float>` **expand_margin_left** = ``0.0`` :ref:`🔗<class_StyleBoxFlat_property_expand_margin_left>`
.. rst-class:: classref-property-setget
- |void| **set_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
將該樣式盒擴充到該控制項矩形的左邊。可以與 :ref:`border_width_left<class_StyleBoxFlat_property_border_width_left>` 組合,在該控制項矩形之外繪製邊框。
\ **注意:**\ 與 :ref:`StyleBox.content_margin_left<class_StyleBox_property_content_margin_left>` 不同,\ :ref:`expand_margin_left<class_StyleBoxFlat_property_expand_margin_left>` *並不會*\ 影響 :ref:`Control<class_Control>` 的可點擊區域。錯誤使用時會對可用性造成負面影響,因為使用者可能會點擊該 StyleBox 上實際無法接受點擊的區域。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_expand_margin_right:
.. rst-class:: classref-property
:ref:`float<class_float>` **expand_margin_right** = ``0.0`` :ref:`🔗<class_StyleBoxFlat_property_expand_margin_right>`
.. rst-class:: classref-property-setget
- |void| **set_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
將該樣式盒擴充到該控制項矩形的右邊。可以與 :ref:`border_width_right<class_StyleBoxFlat_property_border_width_right>` 組合,在該控制項矩形之外繪製邊框。
\ **注意:**\ 與 :ref:`StyleBox.content_margin_right<class_StyleBox_property_content_margin_right>` 不同,\ :ref:`expand_margin_right<class_StyleBoxFlat_property_expand_margin_right>` *並不會*\ 影響 :ref:`Control<class_Control>` 的可點擊區域。錯誤使用時會對可用性造成負面影響,因為使用者可能會點擊該 StyleBox 上實際無法接受點擊的區域。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_expand_margin_top:
.. rst-class:: classref-property
:ref:`float<class_float>` **expand_margin_top** = ``0.0`` :ref:`🔗<class_StyleBoxFlat_property_expand_margin_top>`
.. rst-class:: classref-property-setget
- |void| **set_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
將該樣式盒擴充到該控制項矩形的頂邊。可以與 :ref:`border_width_top<class_StyleBoxFlat_property_border_width_top>` 組合,在該控制項矩形之外繪製邊框。
\ **注意:**\ 與 :ref:`StyleBox.content_margin_top<class_StyleBox_property_content_margin_top>` 不同,\ :ref:`expand_margin_top<class_StyleBoxFlat_property_expand_margin_top>` *並不會*\ 影響 :ref:`Control<class_Control>` 的可點擊區域。錯誤使用時會對可用性造成負面影響,因為使用者可能會點擊該 StyleBox 上實際無法接受點擊的區域。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_shadow_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **shadow_color** = ``Color(0, 0, 0, 0.6)`` :ref:`🔗<class_StyleBoxFlat_property_shadow_color>`
.. rst-class:: classref-property-setget
- |void| **set_shadow_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_shadow_color**\ (\ )
陰影的顏色。如果 :ref:`shadow_size<class_StyleBoxFlat_property_shadow_size>` 小於 1這將不起作用。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_shadow_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **shadow_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_StyleBoxFlat_property_shadow_offset>`
.. rst-class:: classref-property-setget
- |void| **set_shadow_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_shadow_offset**\ (\ )
以圖元為單位的陰影偏移。相對於StyleBox調整陰影的位置。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_shadow_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **shadow_size** = ``0`` :ref:`🔗<class_StyleBoxFlat_property_shadow_size>`
.. rst-class:: classref-property-setget
- |void| **set_shadow_size**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_shadow_size**\ (\ )
以圖元為單位的陰影大小。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_property_skew:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **skew** = ``Vector2(0, 0)`` :ref:`🔗<class_StyleBoxFlat_property_skew>`
.. rst-class:: classref-property-setget
- |void| **set_skew**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_skew**\ (\ )
如果任何軸被設為了非零值,\ :ref:`skew<class_StyleBoxFlat_property_skew>` 就會將該 StyleBox 進行橫向和/或縱向變形。可用於實作“未來風”的 UI。正值會讓該 StyleBox 朝右X 軸Y 軸)偏斜,負值會讓該 StyleBox 朝左X 軸Y 軸)偏斜。
\ **注意:**\ 為了讓文字不觸碰到該 StyleBox 的邊緣,請考慮增大該 :ref:`StyleBox<class_StyleBox>` 的內容邊距(見 :ref:`StyleBox.content_margin_bottom<class_StyleBox_property_content_margin_bottom>`\ )。增大內容邊距比增大擴展邊距(見 :ref:`expand_margin_bottom<class_StyleBoxFlat_property_expand_margin_bottom>`\ )更好,因為增大擴充邊距並不會增大 :ref:`Control<class_Control>` 的可點擊區域。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法說明
--------
.. _class_StyleBoxFlat_method_get_border_width:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| :ref:`🔗<class_StyleBoxFlat_method_get_border_width>`
返回指定邊 :ref:`Side<enum_@GlobalScope_Side>` 的邊框寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_get_border_width_min:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_border_width_min**\ (\ ) |const| :ref:`🔗<class_StyleBoxFlat_method_get_border_width_min>`
返回所有四條邊中,最小的邊框寬度。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_get_corner_radius:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`\ ) |const| :ref:`🔗<class_StyleBoxFlat_method_get_corner_radius>`
Returns the given ``corner``'s radius.
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_get_expand_margin:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| :ref:`🔗<class_StyleBoxFlat_method_get_expand_margin>`
返回指定邊 :ref:`Side<enum_@GlobalScope_Side>` 的擴充邊距的大小。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_border_width:
.. rst-class:: classref-method
|void| **set_border_width**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, width\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_border_width>`
將指定邊 :ref:`Side<enum_@GlobalScope_Side>` 的邊框寬度設定為 ``width`` 圖元。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_border_width_all:
.. rst-class:: classref-method
|void| **set_border_width_all**\ (\ width\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_border_width_all>`
將所有邊的邊框寬度設定為 ``width`` 圖元。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_corner_radius:
.. rst-class:: classref-method
|void| **set_corner_radius**\ (\ corner\: :ref:`Corner<enum_@GlobalScope_Corner>`, radius\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_corner_radius>`
Sets the corner radius to ``radius`` pixels for the given ``corner``.
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_corner_radius_all:
.. rst-class:: classref-method
|void| **set_corner_radius_all**\ (\ radius\: :ref:`int<class_int>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_corner_radius_all>`
將所有角的圓角半徑設定為 ``radius`` 圖元。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_expand_margin:
.. rst-class:: classref-method
|void| **set_expand_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, size\: :ref:`float<class_float>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_expand_margin>`
將指定邊 :ref:`Side<enum_@GlobalScope_Side>` 的擴充邊距設定為 ``size`` 圖元。
.. rst-class:: classref-item-separator
----
.. _class_StyleBoxFlat_method_set_expand_margin_all:
.. rst-class:: classref-method
|void| **set_expand_margin_all**\ (\ size\: :ref:`float<class_float>`\ ) :ref:`🔗<class_StyleBoxFlat_method_set_expand_margin_all>`
將所有邊的擴充邊距都設定為 ``size`` 圖元。
.. |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 (無回傳值。)`