:github_url: hide .. meta:: :keywords: text .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.4/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.4/doc/classes/Label.xml. .. _class_Label: Label ===== **继承:** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` 用于显示纯文本的控件。 .. rst-class:: classref-introduction-group 描述 ---- 用于显示纯文本的控件。可以控制水平和垂直对齐方式以及文本在节点包围框内的换行方式。不支持粗体、斜体等富文本格式。这种需求请改用 :ref:`RichTextLabel`\ 。 .. rst-class:: classref-introduction-group 教程 ---- - `2D Dodge The Creeps 演示 `__ .. rst-class:: classref-reftable-group 属性 ---- .. table:: :widths: auto +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`AutowrapMode` | :ref:`autowrap_mode` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`clip_text` | ``false`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`String` | :ref:`ellipsis_char` | ``"…"`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`HorizontalAlignment` | :ref:`horizontal_alignment` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | |bitfield|\[:ref:`JustificationFlag`\] | :ref:`justification_flags` | ``163`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`LabelSettings` | :ref:`label_settings` | | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`String` | :ref:`language` | ``""`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`lines_skipped` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`max_lines_visible` | ``-1`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`MouseFilter` | mouse_filter | ``2`` (overrides :ref:`Control`) | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`String` | :ref:`paragraph_separator` | ``"\\n"`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | |bitfield|\[:ref:`SizeFlags`\] | size_flags_vertical | ``4`` (overrides :ref:`Control`) | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`StructuredTextParser` | :ref:`structured_text_bidi_override` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`structured_text_bidi_override_options` | ``[]`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`PackedFloat32Array` | :ref:`tab_stops` | ``PackedFloat32Array()`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`String` | :ref:`text` | ``""`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`TextDirection` | :ref:`text_direction` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`OverrunBehavior` | :ref:`text_overrun_behavior` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`uppercase` | ``false`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`VerticalAlignment` | :ref:`vertical_alignment` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`int` | :ref:`visible_characters` | ``-1`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`VisibleCharactersBehavior` | :ref:`visible_characters_behavior` | ``0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | :ref:`float` | :ref:`visible_ratio` | ``1.0`` | +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group 方法 ---- .. table:: :widths: auto +---------------------------+-----------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_character_bounds`\ (\ pos\: :ref:`int`\ ) |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_line_count`\ (\ ) |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_line_height`\ (\ line\: :ref:`int` = -1\ ) |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_total_character_count`\ (\ ) |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_visible_line_count`\ (\ ) |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group 主题属性 -------- .. table:: :widths: auto +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`Color` | :ref:`font_color` | ``Color(1, 1, 1, 1)`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`Color` | :ref:`font_outline_color` | ``Color(0, 0, 0, 1)`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`Color` | :ref:`font_shadow_color` | ``Color(0, 0, 0, 0)`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`line_spacing` | ``3`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`outline_size` | ``0`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`paragraph_spacing` | ``0`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`shadow_offset_x` | ``1`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`shadow_offset_y` | ``1`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`shadow_outline_size` | ``1`` | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`Font` | :ref:`font` | | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`int` | :ref:`font_size` | | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ | :ref:`StyleBox` | :ref:`normal` | | +---------------------------------+----------------------------------------------------------------------------+-----------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 属性说明 -------- .. _class_Label_property_autowrap_mode: .. rst-class:: classref-property :ref:`AutowrapMode` **autowrap_mode** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_autowrap_mode**\ (\ value\: :ref:`AutowrapMode`\ ) - :ref:`AutowrapMode` **get_autowrap_mode**\ (\ ) 如果设置为 :ref:`TextServer.AUTOWRAP_OFF` 以外的值,则文本将在节点的边界矩形内自动换行。如果你调整节点大小,就会自动更改其高度,从而显示所有文本。要了解每种模式的行为方式,请参阅 :ref:`AutowrapMode`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_clip_text: .. rst-class:: classref-property :ref:`bool` **clip_text** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_clip_text**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_clipping_text**\ (\ ) 如果为 ``true``\ ,Label 将仅显示位于其边界矩形内部的文本,并将水平裁剪文本。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_ellipsis_char: .. rst-class:: classref-property :ref:`String` **ellipsis_char** = ``"…"`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_ellipsis_char**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_ellipsis_char**\ (\ ) 用于文本裁剪的省略字符。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_horizontal_alignment: .. rst-class:: classref-property :ref:`HorizontalAlignment` **horizontal_alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_horizontal_alignment**\ (\ value\: :ref:`HorizontalAlignment`\ ) - :ref:`HorizontalAlignment` **get_horizontal_alignment**\ (\ ) 控制文本的水平对齐方式。支持左对齐、居中对齐、右对齐、填充(即两端对齐)。请将其设置为 :ref:`HorizontalAlignment` 常量。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_justification_flags: .. rst-class:: classref-property |bitfield|\[:ref:`JustificationFlag`\] **justification_flags** = ``163`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_justification_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag`\]\ ) - |bitfield|\[:ref:`JustificationFlag`\] **get_justification_flags**\ (\ ) 行两端对齐规则。详见 :ref:`JustificationFlag`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_label_settings: .. rst-class:: classref-property :ref:`LabelSettings` **label_settings** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_label_settings**\ (\ value\: :ref:`LabelSettings`\ ) - :ref:`LabelSettings` **get_label_settings**\ (\ ) :ref:`LabelSettings` 资源,可以在多个 **Label** 节点之间共享。优先于主题属性。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_language: .. rst-class:: classref-property :ref:`String` **language** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_language**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_language**\ (\ ) 语言代码,用于断行和文本塑形算法,如果留空则使用当前区域设置。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_lines_skipped: .. rst-class:: classref-property :ref:`int` **lines_skipped** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_lines_skipped**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_lines_skipped**\ (\ ) 从 :ref:`text` 值的开头开始忽略且不显示的行数。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_max_lines_visible: .. rst-class:: classref-property :ref:`int` **max_lines_visible** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_max_lines_visible**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_max_lines_visible**\ (\ ) 限制节点在屏幕上显示的文本行数。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_paragraph_separator: .. rst-class:: classref-property :ref:`String` **paragraph_separator** = ``"\\n"`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_paragraph_separator**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_paragraph_separator**\ (\ ) 段落分隔符字符串。段落独立处理,使用自己的 BiDi 上下文。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_structured_text_bidi_override: .. rst-class:: classref-property :ref:`StructuredTextParser` **structured_text_bidi_override** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_structured_text_bidi_override**\ (\ value\: :ref:`StructuredTextParser`\ ) - :ref:`StructuredTextParser` **get_structured_text_bidi_override**\ (\ ) 为结构化文本设置 BiDi 算法覆盖。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_structured_text_bidi_override_options: .. rst-class:: classref-property :ref:`Array` **structured_text_bidi_override_options** = ``[]`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_structured_text_bidi_override_options**\ (\ value\: :ref:`Array`\ ) - :ref:`Array` **get_structured_text_bidi_override_options**\ (\ ) 设置 BiDi 覆盖的附加选项。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_tab_stops: .. rst-class:: classref-property :ref:`PackedFloat32Array` **tab_stops** = ``PackedFloat32Array()`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_tab_stops**\ (\ value\: :ref:`PackedFloat32Array`\ ) - :ref:`PackedFloat32Array` **get_tab_stops**\ (\ ) 将文本与给定的制表位对齐。 **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array` for more details. .. rst-class:: classref-item-separator ---- .. _class_Label_property_text: .. rst-class:: classref-property :ref:`String` **text** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_text**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_text**\ (\ ) 要在屏幕上显示的文本。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_text_direction: .. rst-class:: classref-property :ref:`TextDirection` **text_direction** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_text_direction**\ (\ value\: :ref:`TextDirection`\ ) - :ref:`TextDirection` **get_text_direction**\ (\ ) 基础文本书写方向。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_text_overrun_behavior: .. rst-class:: classref-property :ref:`OverrunBehavior` **text_overrun_behavior** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior`\ ) - :ref:`OverrunBehavior` **get_text_overrun_behavior**\ (\ ) 设置文本超出节点的边界矩形时的裁剪行为。有关所有模式的描述,请参阅 :ref:`OverrunBehavior`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_uppercase: .. rst-class:: classref-property :ref:`bool` **uppercase** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_uppercase**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_uppercase**\ (\ ) 如果为 ``true``\ ,所有文本都将显示为大写。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_vertical_alignment: .. rst-class:: classref-property :ref:`VerticalAlignment` **vertical_alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_vertical_alignment**\ (\ value\: :ref:`VerticalAlignment`\ ) - :ref:`VerticalAlignment` **get_vertical_alignment**\ (\ ) 控制文本的垂直对齐方式。支持顶部对齐、居中对齐、底部对齐和填充。将其设置为 :ref:`VerticalAlignment` 常量之一。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_visible_characters: .. rst-class:: classref-property :ref:`int` **visible_characters** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_visible_characters**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_visible_characters**\ (\ ) 要显示的字符数。如果设置为 ``-1``\ ,则显示所有字符。这用于在对话框中为显示的文本设置动画。 \ **注意:**\ 设置该属性会相应地更新 :ref:`visible_ratio`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_visible_characters_behavior: .. rst-class:: classref-property :ref:`VisibleCharactersBehavior` **visible_characters_behavior** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_visible_characters_behavior**\ (\ value\: :ref:`VisibleCharactersBehavior`\ ) - :ref:`VisibleCharactersBehavior` **get_visible_characters_behavior**\ (\ ) 设置 :ref:`visible_characters` 或 :ref:`visible_ratio` 被设置时的裁剪行为。有关详细信息,请参阅 :ref:`VisibleCharactersBehavior`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_property_visible_ratio: .. rst-class:: classref-property :ref:`float` **visible_ratio** = ``1.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_visible_ratio**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_visible_ratio**\ (\ ) 相对于字符总数(参见 :ref:`get_total_character_count()`\ ),要显示的字符的占比。如果设置为 ``1.0``\ ,则显示所有字符。如果设置为 ``0.5``\ ,则只显示一半的字符。这用于在对话框中为显示的文本设置动画。 \ **注意:**\ 设置该属性会相应地更新 :ref:`visible_characters`\ 。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 方法说明 -------- .. _class_Label_method_get_character_bounds: .. rst-class:: classref-method :ref:`Rect2` **get_character_bounds**\ (\ pos\: :ref:`int`\ ) |const| :ref:`🔗` 返回位置 ``pos`` 处字符的边界矩形,使用标签的局部坐标系。如果字符是不可见字符或 ``pos`` 超出有效范围,则返回空 :ref:`Rect2`\ 。如果字符是复合字素的一部分,则返回整个字素的边界矩形。 .. rst-class:: classref-item-separator ---- .. _class_Label_method_get_line_count: .. rst-class:: classref-method :ref:`int` **get_line_count**\ (\ ) |const| :ref:`🔗` 返回该 Label 的文本行数。 .. rst-class:: classref-item-separator ---- .. _class_Label_method_get_line_height: .. rst-class:: classref-method :ref:`int` **get_line_height**\ (\ line\: :ref:`int` = -1\ ) |const| :ref:`🔗` 返回行 ``line`` 的高度。 如果 ``line`` 被设置为 ``-1`` ,则返回最大的行高。 如果没有行,则返回字体大小,单位是像素。 .. rst-class:: classref-item-separator ---- .. _class_Label_method_get_total_character_count: .. rst-class:: classref-method :ref:`int` **get_total_character_count**\ (\ ) |const| :ref:`🔗` 返回文本中可打印的字符总数,不包括空格和换行符。 .. rst-class:: classref-item-separator ---- .. _class_Label_method_get_visible_line_count: .. rst-class:: classref-method :ref:`int` **get_visible_line_count**\ (\ ) |const| :ref:`🔗` 返回显示的行数。如果 **Label** 的高度目前无法显示所有的行数,将会有用。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 主题属性说明 ------------ .. _class_Label_theme_color_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗` **Label** 标签的默认文本颜色 :ref:`Color`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_color_font_outline_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗` 文本轮廓的颜色。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_color_font_shadow_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_shadow_color** = ``Color(0, 0, 0, 0)`` :ref:`🔗` 文本阴影效果的颜色 :ref:`Color`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_line_spacing: .. rst-class:: classref-themeproperty :ref:`int` **line_spacing** = ``3`` :ref:`🔗` 行与行之间的额外纵向留白(单位为像素),留白会被添加到行的降部。该值可以为负数。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_outline_size: .. rst-class:: classref-themeproperty :ref:`int` **outline_size** = ``0`` :ref:`🔗` 文字轮廓的大小。 \ **注意:**\ 如果使用启用了 :ref:`FontFile.multichannel_signed_distance_field` 的字体,其 :ref:`FontFile.msdf_pixel_range` 必须至少设置为 :ref:`outline_size` 的\ *两倍*\ ,轮廓渲染才能看起来正确。否则,轮廓可能会比预期的更早被切断。 \ **注意:**\ 不建议使用大于字体大小一半的值,因为这种情况下字体轮廓可能无法完全闭合。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_paragraph_spacing: .. rst-class:: classref-themeproperty :ref:`int` **paragraph_spacing** = ``0`` :ref:`🔗` 段落之间的垂直空间。在 :ref:`line_spacing` 上添加。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_shadow_offset_x: .. rst-class:: classref-themeproperty :ref:`int` **shadow_offset_x** = ``1`` :ref:`🔗` 文本阴影的水平偏移。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_shadow_offset_y: .. rst-class:: classref-themeproperty :ref:`int` **shadow_offset_y** = ``1`` :ref:`🔗` 文本阴影的垂直偏移。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_constant_shadow_outline_size: .. rst-class:: classref-themeproperty :ref:`int` **shadow_outline_size** = ``1`` :ref:`🔗` 阴影轮廓的大小。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_font_font: .. rst-class:: classref-themeproperty :ref:`Font` **font** :ref:`🔗` 用于标签 **Label** 文本的字体 :ref:`Font`\ 。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_font_size_font_size: .. rst-class:: classref-themeproperty :ref:`int` **font_size** :ref:`🔗` 该 **Label** 文本的字体大小。 .. rst-class:: classref-item-separator ---- .. _class_Label_theme_style_normal: .. rst-class:: classref-themeproperty :ref:`StyleBox` **normal** :ref:`🔗` 为 **Label** 设置背景样式盒 :ref:`StyleBox`\ 。 .. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)` .. |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 (无返回值。)`