Skip to content

StyleBoxFlat

Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

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

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

Overview

Provides a rectangle style box with a fill color and optional borders.

Syntax

public class Electron2D.StyleBoxFlat : Electron2D.StyleBox

Godot 4.7 C# profile compatibility

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

Flat style-box resource with background color, border color and border-width drawing.

Remarks

StyleBoxFlat is the lightweight style resource used by the preview UI theme system for panels, buttons and tooltip backgrounds.

Thread Safety

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

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.StyleBox
  • Electron2D.Theme.SetStyleBox(System.String,System.String,Electron2D.StyleBox)

Members

Member Kind Summary
BgColor Property Gets or sets the background color.
BorderColor Property Gets or sets the border color.
BorderWidthBottom Property Gets or sets the bottom border width.
BorderWidthLeft Property Gets or sets the left border width.
BorderWidthRight Property Gets or sets the right border width.
BorderWidthTop Property Gets or sets the top border width.
Electron2D.StyleBoxFlat() Constructor Initializes a new instance of the Electron2D.StyleBoxFlat class.
Draw(Electron2D.CanvasItem, Electron2D.Rect2) Method Draws the flat background and borders into a canvas item.

Member Details

BgColor

Kind: Property

public Electron2D.Color BgColor { get; set; }

Summary

Gets or sets the background color.

Remarks

The default value is an opaque neutral gray.

Value

The fill color drawn over the target rectangle.

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.StyleBoxFlat.Draw(Electron2D.CanvasItem,Electron2D.Rect2)

BorderColor

Kind: Property

public Electron2D.Color BorderColor { get; set; }

Summary

Gets or sets the border color.

Remarks

Border rectangles are drawn after the background.

Value

The color used for every non-zero border side.

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.StyleBoxFlat.BorderWidthLeft

BorderWidthBottom

Kind: Property

public System.Int32 BorderWidthBottom { get; set; }

Summary

Gets or sets the bottom border width.

Remarks

A value of 0 disables the bottom border.

Value

The bottom border width in UI units. The value must be non-negative.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the assigned value is negative.

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.StyleBoxFlat.BorderColor

BorderWidthLeft

Kind: Property

public System.Int32 BorderWidthLeft { get; set; }

Summary

Gets or sets the left border width.

Remarks

A value of 0 disables the left border.

Value

The left border width in UI units. The value must be non-negative.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the assigned value is negative.

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.StyleBoxFlat.BorderColor

BorderWidthRight

Kind: Property

public System.Int32 BorderWidthRight { get; set; }

Summary

Gets or sets the right border width.

Remarks

A value of 0 disables the right border.

Value

The right border width in UI units. The value must be non-negative.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the assigned value is negative.

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.StyleBoxFlat.BorderColor

BorderWidthTop

Kind: Property

public System.Int32 BorderWidthTop { get; set; }

Summary

Gets or sets the top border width.

Remarks

A value of 0 disables the top border.

Value

The top border width in UI units. The value must be non-negative.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the assigned value is negative.

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.StyleBoxFlat.BorderColor

Electron2D.StyleBoxFlat()

Kind: Constructor

public Electron2D.StyleBoxFlat()

Summary

Initializes a new instance of the Electron2D.StyleBoxFlat class.

Remarks

The new style box uses a neutral gray background, a light border color and zero border widths.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.StyleBoxFlat

Draw(Electron2D.CanvasItem, Electron2D.Rect2)

Kind: Method

public System.Void Draw(Electron2D.CanvasItem, Electron2D.Rect2)(Electron2D.CanvasItem canvasItem, Electron2D.Rect2 rect)

Summary

Draws the flat background and borders into a canvas item.

Remarks

The background is drawn first, then each non-zero border side is drawn as a filled rectangle.

Parameters

  • canvasItem: The canvas item that receives draw commands.
  • rect: The local rectangle to draw into.

Exceptions

  • System.ArgumentNullException: Thrown when canvasItem is null.
  • System.ArgumentOutOfRangeException: Thrown when rect contains non-finite components.

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.CanvasItem.DrawRect(Electron2D.Rect2,Electron2D.Color,System.Boolean,System.Single,System.Boolean)

Clone this wiki locally