Skip to content
Eduard Gushchin edited this page Jun 24, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Label
Namespace Electron2D
Kind class
Category UI and Text

Overview

Provides the Electron2D control for drawing a single line of plain text.

Syntax

public class Electron2D.Label : Electron2D.Control

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: Label

Single-line plain text control backed by theme font overrides and CanvasItem.DrawString.

Remarks

Label uses the font and font_size theme overrides from Electron2D.Control and submits text through Electron2D.CanvasItem.DrawString(Electron2D.Font,Electron2D.Vector2,System.String,Electron2D.HorizontalAlignment,System.Single,System.Int32,System.Nullable{Electron2D.Color}). Multiline wrapping, clipping, overrun behavior, language-specific shaping and label settings are planned later UI/text tasks.

Thread Safety

This type is not synchronized. Create and mutate labels on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control
  • Electron2D.Font

Members

Member Kind Summary
HorizontalAlignment Property Gets or sets the horizontal alignment used when drawing text inside Electron2D.Control.Size.
Text Property Gets or sets the plain text drawn by this label.
Uppercase Property Gets or sets whether text is converted to invariant uppercase before drawing.
VerticalAlignment Property Gets or sets the vertical alignment used when drawing text inside Electron2D.Control.Size.
Electron2D.Label() Constructor Initializes a new instance of the Label type.
_Draw() Method Draws the label text when the control is redrawn.
_Process(System.Double) Method Queues a redraw when the translation state changes.

Member Details

HorizontalAlignment

Kind: Property

public Electron2D.HorizontalAlignment HorizontalAlignment { get; set; }

Summary

Gets or sets the horizontal alignment used when drawing text inside Electron2D.Control.Size.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current horizontal alignment value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

Text

Kind: Property

public System.String Text { get; set; }

Summary

Gets or sets the plain text drawn by this label.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current text value.

Exceptions

  • System.ArgumentNullException: Thrown when the assigned value is null.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

Uppercase

Kind: Property

public System.Boolean Uppercase { get; set; }

Summary

Gets or sets whether text is converted to invariant uppercase before drawing.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current uppercase value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

VerticalAlignment

Kind: Property

public Electron2D.VerticalAlignment VerticalAlignment { get; set; }

Summary

Gets or sets the vertical alignment used when drawing text inside Electron2D.Control.Size.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current vertical alignment value.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

Electron2D.Label()

Kind: Constructor

public Electron2D.Label()

Summary

Initializes a new instance of the Label type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

_Draw()

Kind: Method

public System.Void _Draw()()

Summary

Draws the label text when the control is redrawn.

Remarks

The method reads the font and font_size theme overrides. If no font override exists, no draw command is submitted.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

_Process(System.Double)

Kind: Method

public System.Void _Process(System.Double)(System.Double delta)

Summary

Queues a redraw when the translation state changes.

Remarks

Labels draw Electron2D.Label.Text through Electron2D.Object.Tr(System.String,System.String). This callback observes locale and translation registry changes so cached draw commands are refreshed on the next processed frame.

Parameters

  • delta: The elapsed frame time in seconds.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Label

Clone this wiki locally