Click or drag to resize

ControlAddStyleboxOverride Method

Overrides the StyleBox with given name in the Theme resource the control uses. If stylebox is empty or invalid, the override is cleared and the StyleBox from assigned Theme is used.

Example of modifying a property in a StyleBox by duplicating it:

# The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
# Resources are shared across instances, so we need to duplicate it
# to avoid modifying the appearance of all other buttons.
var new_stylebox_normal = $MyButton.get_stylebox("normal").duplicate()
new_stylebox_normal.border_width_top = 3
new_stylebox_normal.border_color = Color(0, 1, 0.5)
$MyButton.add_stylebox_override("normal", new_stylebox_normal)

# Remove the stylebox override:
$MyButton.add_stylebox_override("normal", null)

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public void AddStyleboxOverride(
	string name,
	StyleBox stylebox
)

Parameters

name
Type: SystemString

[Missing <param name="name"/> documentation for "M:Godot.Control.AddStyleboxOverride(System.String,Godot.StyleBox)"]

stylebox
Type: GodotStyleBox

[Missing <param name="stylebox"/> documentation for "M:Godot.Control.AddStyleboxOverride(System.String,Godot.StyleBox)"]

See Also