Table of Contents

Class NinePatchRect

Namespace
Godot
Assembly
GodotSharp.dll

Also known as 9-slice panels, NinePatchRect produces clean panels of any size based on a small texture. To do so, it splits the texture in a 3×3 grid. When you scale the node, it tiles the texture's edges horizontally or vertically, tiles the center on both axes, and leaves the corners unchanged.

public class NinePatchRect : Control, IDisposable
Inheritance
NinePatchRect
Implements
Inherited Members

Constructors

NinePatchRect()

public NinePatchRect()

Properties

AxisStretchHorizontal

The stretch mode to use for horizontal stretching/tiling. See NinePatchRect.AxisStretchMode for possible values.

public NinePatchRect.AxisStretchMode AxisStretchHorizontal { get; set; }

Property Value

NinePatchRect.AxisStretchMode

AxisStretchVertical

The stretch mode to use for vertical stretching/tiling. See NinePatchRect.AxisStretchMode for possible values.

public NinePatchRect.AxisStretchMode AxisStretchVertical { get; set; }

Property Value

NinePatchRect.AxisStretchMode

DrawCenter

If true, draw the panel's center. Else, only draw the 9-slice's borders.

public bool DrawCenter { get; set; }

Property Value

bool

PatchMarginBottom

The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

public int PatchMarginBottom { get; set; }

Property Value

int

PatchMarginLeft

The width of the 9-slice's left column. A margin of 16 means the 9-slice's left corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

public int PatchMarginLeft { get; set; }

Property Value

int

PatchMarginRight

The width of the 9-slice's right column. A margin of 16 means the 9-slice's right corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

public int PatchMarginRight { get; set; }

Property Value

int

PatchMarginTop

The height of the 9-slice's top row. A margin of 16 means the 9-slice's top corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.

public int PatchMarginTop { get; set; }

Property Value

int

RegionRect

Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture.

public Rect2 RegionRect { get; set; }

Property Value

Rect2

Texture

The node's texture resource.

public Texture2D Texture { get; set; }

Property Value

Texture2D

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

Events

TextureChanged

Emitted when the node's texture changes.

public event Action TextureChanged

Event Type

Action