Skip to content

Control

Eduard Gushchin edited this page Jun 21, 2026 · 9 revisions

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

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

Overview

Provides the Electron2D base node for 2D user interface controls.

Syntax

public class Electron2D.Control : Electron2D.CanvasItem

Remarks

Control inherits from Electron2D.CanvasItem and adds a rectangular UI area plus minimal theme font overrides used by Electron2D.Label in Electron2D 0.1.0 Preview. Anchors, containers, focus and input filtering are planned UI tasks and are not implemented by this baseline.

Thread Safety

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

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CanvasItem
  • Electron2D.Label

Members

Member Kind Summary
Position Property Gets or sets the local position of this control.
Size Property Gets or sets the local size of this control.
Electron2D.Control() Constructor Initializes a new instance of the Control type.
AddThemeFontOverride(System.String, Electron2D.Font) Method Adds or replaces a font theme override for this control.
AddThemeFontSizeOverride(System.String, System.Int32) Method Adds or replaces a font size theme override for this control.
GetThemeFont(System.String) Method Gets a font theme override by name.
GetThemeFontSize(System.String) Method Gets a font size theme override by name.

Member Details

Position

Kind: Property

public Electron2D.Vector2 Position { get; set; }

Summary

Gets or sets the local position of this control.

Remarks

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

Value

The current position 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.Control

Size

Kind: Property

public Electron2D.Vector2 Size { get; set; }

Summary

Gets or sets the local size of this control.

Remarks

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

Value

The current size 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.Control

Electron2D.Control()

Kind: Constructor

public Electron2D.Control()

Summary

Initializes a new instance of the Control 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.Control

AddThemeFontOverride(System.String, Electron2D.Font)

Kind: Method

public System.Void AddThemeFontOverride(System.String, Electron2D.Font)(System.String name, Electron2D.Font font)

Summary

Adds or replaces a font theme override for this control.

Remarks

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

Parameters

  • name: The theme font name, for example font.
  • font: The font resource to use.

Exceptions

  • System.ArgumentException: Thrown when name is null, empty or whitespace.
  • System.ArgumentNullException: Thrown when font is null.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control

AddThemeFontSizeOverride(System.String, System.Int32)

Kind: Method

public System.Void AddThemeFontSizeOverride(System.String, System.Int32)(System.String name, System.Int32 fontSize)

Summary

Adds or replaces a font size theme override for this control.

Remarks

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

Parameters

  • name: The theme font size name, for example font_size.
  • fontSize: The font size in pixels. It must be greater than zero.

Exceptions

  • System.ArgumentException: Thrown when name is null, empty or whitespace.
  • System.ArgumentOutOfRangeException: Thrown when fontSize is less than or equal to zero.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control

GetThemeFont(System.String)

Kind: Method

public Electron2D.Font GetThemeFont(System.String)(System.String name)

Summary

Gets a font theme override by name.

Remarks

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

Parameters

  • name: The theme font name.

Returns

The overridden font, or null when no override exists.

Exceptions

  • System.ArgumentException: Thrown when name is null, empty or whitespace.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control

GetThemeFontSize(System.String)

Kind: Method

public System.Int32 GetThemeFontSize(System.String)(System.String name)

Summary

Gets a font size theme override by name.

Remarks

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

Parameters

  • name: The theme font size name.

Returns

The overridden font size in pixels, or 16 when no override exists.

Exceptions

  • System.ArgumentException: Thrown when name is null, empty or whitespace.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control

Clone this wiki locally