StyleBoxTexture
Textured nine-patch style with independent padding and draw expansion.
Assign Texture, optionally RegionRect for a source subregion, and four TextureMargin values to split it into nine regions. Corners retain local dimensions; edges/center stretch or repeat according to AxisStretchHorizontal/Vertical. RegionRect uses source pixels; zero Rect2 uses the whole texture. Validate nonnegative border sums against the source region.
TextureMargin defines slicing. ContentMargin defines content padding: negative values use corresponding TextureMargin, explicit values override it. For example, texture border 4 and ContentMarginLeft = 10 retain slicing at 4 but pad content by 10. Resolved padding determines minimum even with Texture = null; full texture dimensions are not the style minimum.
ExpandMargin only expands drawing beyond the supplied rect. It does not enlarge ContentMargin, minimum size or hit area. DrawCenter = false suppresses the center without changing padding. ModulateColor multiplies image color/alpha without editing source pixels.
Texture reference replacement emits Changed, but the assigned texture’s internal Changed is not forwarded through StyleBoxTexture. If a dynamic resource’s size/region changes require consumer refresh, explicitly notify the style through EmitChanged. Ordinary Duplicate separates style values while retaining shared Texture.
Choose Tile or TileFit to repeat patterns; TileFit adjusts a whole repeat count. Verify filtering/atlas results on the target renderer.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
StyleBoxTextureConstructor
public StyleBoxTexture();Creates a style without Texture: slice/expand margins 0, DrawCenter = true, white ModulateColor, both axes Stretch. Inherits automatic ContentMargin = -1.
Properties14
AxisStretchHorizontalProperty
public StyleBoxTexture.AxisStretchMode AxisStretchHorizontal { get; set; }Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.
AxisStretchVerticalProperty
public StyleBoxTexture.AxisStretchMode AxisStretchVertical { get; set; }Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.
DrawCenterProperty
public bool DrawCenter { get; set; }Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.
ExpandMarginBottomProperty
public float ExpandMarginBottom { get; set; }Decorative Bottom drawing expansion, default 0. Does not change minimum or content padding.
ExpandMarginLeftProperty
public float ExpandMarginLeft { get; set; }Decorative Left drawing expansion, default 0. Does not change minimum or content padding.
ExpandMarginRightProperty
public float ExpandMarginRight { get; set; }Decorative Right drawing expansion, default 0. Does not change minimum or content padding.
ExpandMarginTopProperty
public float ExpandMarginTop { get; set; }Decorative Top drawing expansion, default 0. Does not change minimum or content padding.
ModulateColorProperty
public Color ModulateColor { get; set; }Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.
RegionRectProperty
public Rect2 RegionRect { get; set; }Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.
TextureProperty
public Texture2D Texture { get; set; }Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.
TextureMarginBottomProperty
public float TextureMarginBottom { get; set; }Source-pixel Bottom slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.
TextureMarginLeftProperty
public float TextureMarginLeft { get; set; }Source-pixel Left slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.
TextureMarginRightProperty
public float TextureMarginRight { get; set; }Source-pixel Right slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.
TextureMarginTopProperty
public float TextureMarginTop { get; set; }Source-pixel Top slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.
Methods18
GetExpandMarginfloat
public float GetExpandMargin(Side margin);Returns decorative drawing expansion on a side rather than resolved content padding.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
marginSide.Left, Top, Right or Bottom.
floatSide drawing expansion in pixels.
GetHAxisStretchModeStyleBoxTexture.AxisStretchMode
public StyleBoxTexture.AxisStretchMode GetHAxisStretchMode();Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.
StyleBoxTexture.AxisStretchModeSelected horizontal AxisStretchMode.
GetModulateColor
public Color GetModulate();Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.
ColorDrawing color/alpha multiplier.
GetRegionRectRect2
public Rect2 GetRegionRect();Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.
Rect2Stored source pixel-region Rect2.
GetTextureTexture2D
public Texture2D GetTexture();Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.
Texture2DShared Texture2D, or null.
GetTextureMarginfloat
public float GetTextureMargin(Side margin);Returns texture-slice border thickness in pixels. Also supplies automatic content padding when corresponding ContentMargin is negative.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
marginSide.Left, Top, Right or Bottom.
floatSlice-border thickness in pixels.
GetVAxisStretchModeStyleBoxTexture.AxisStretchMode
public StyleBoxTexture.AxisStretchMode GetVAxisStretchMode();Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.
StyleBoxTexture.AxisStretchModeSelected vertical AxisStretchMode.
IsDrawCenterEnabledbool
public bool IsDrawCenterEnabled();Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.
booltrue when the center is drawn.
SetDrawCentervoid
public void SetDrawCenter(bool enable);Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.
| Name | Type | Default |
|---|---|---|
enable | bool | — |
enableDraw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.
SetExpandMarginvoid
public void SetExpandMargin(Side margin, float size);Sets decorative drawing overflow beyond rect and emits Changed. Does not enlarge ContentMargin, minimum or Control hit area.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
size | float | — |
marginSide.Left, Top, Right or Bottom.
sizeSets decorative drawing overflow beyond rect and emits Changed. Does not enlarge ContentMargin, minimum or Control hit area.
SetExpandMarginAllvoid
public void SetExpandMarginAll(float size);Sets the same drawing expansion on all sides and emits Changed once. Layout does not reserve that area.
| Name | Type | Default |
|---|---|---|
size | float | — |
sizeSets the same drawing expansion on all sides and emits Changed once. Layout does not reserve that area.
SetHAxisStretchModevoid
public void SetHAxisStretchMode(StyleBoxTexture.AxisStretchMode mode);Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.
| Name | Type | Default |
|---|---|---|
mode | StyleBoxTexture.AxisStretchMode | — |
modeHorizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.
SetModulatevoid
public void SetModulate(Color color);Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorDrawing color/alpha multiplier, default white. Does not edit Texture or change content padding.
SetRegionRectvoid
public void SetRegionRect(Rect2 region);Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.
| Name | Type | Default |
|---|---|---|
region | Rect2 | — |
regionSource pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.
SetTexturevoid
public void SetTexture(Texture2D texture);Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.
| Name | Type | Default |
|---|---|---|
texture | Texture2D | — |
textureShared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.
SetTextureMarginvoid
public void SetTextureMargin(Side margin, float size);Sets slice-border thickness and emits Changed. Use nonnegative values with opposite-border sums fitting the source region. Can change automatic minimum size.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
size | float | — |
marginSide.Left, Top, Right or Bottom.
sizeSets slice-border thickness and emits Changed. Use nonnegative values with opposite-border sums fitting the source region. Can change automatic minimum size.
SetTextureMarginAllvoid
public void SetTextureMarginAll(float size);Sets the same slice border on every side and emits Changed once. Does not overwrite explicit ContentMargin.
| Name | Type | Default |
|---|---|---|
size | float | — |
sizeSets the same slice border on every side and emits Changed once. Does not overwrite explicit ContentMargin.
SetVAxisStretchModevoid
public void SetVAxisStretchMode(StyleBoxTexture.AxisStretchMode mode);Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.
| Name | Type | Default |
|---|---|---|
mode | StyleBoxTexture.AxisStretchMode | — |
modeIndependent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.
StyleBoxTexture.AxisStretchMode
| Value | Description |
|---|---|
Stretch = 0 | Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly. |
Tile = 1 | Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. |
TileFit = 2 | Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. Unlike |