StyleBoxFlat
Texture-free panel with fill, borders, rounded corners and shadow.
Assign StyleBoxFlat to an element’s theme slot, such as panel on PanelContainer or normal on Button. Elements can share this resource; use Duplicate for independent styling. Default fill is gray (0.6, 0.6, 0.6, 1); borders have color (0.8, 0.8, 0.8, 1) but zero width. DrawCenter is enabled. Own-property setters emit Changed even when assigning the same value again.
BorderWidth defines both painted borders and automatic content padding. A negative corresponding ContentMargin uses border thickness; explicit ContentMargin takes priority. For example, borders of 4 on all sides yield style minimum (8, 8), while ContentMarginLeft = 10 changes left padding only. GetBorderWidthMin returns the smallest of four widths rather than Control minimum size.
CornerRadius stores requested pixel radii. Drawing adapts borders and curves to the available rectangle without changing stored properties. A large radius does not increase panel minimum size. CornerDetail sets arc segment count: default 8, range 1–20. Use nonnegative border widths and radii.
AntiAliasing defaults to enabled but applies only to rounded corners or nonzero Skew. An unskewed square-cornered rectangle receives no additional edge feathering. AntiAliasingSize is feather width, default 1, clamped to 0.01–10; drawing accounts for canvas scale. This is local style antialiasing, separate from MSAA/FXAA.
ExpandMargin extends drawing; ShadowSize and ShadowOffset add a decorative shadow. They do not reserve container space or increase ContentMargin. Default ShadowSize = 0 means no shadow even though ShadowColor is already (0, 0, 0, 0.6). Shadow drawing fades towards transparency; ShadowSize is not a Gaussian blur radius. Allow space around the panel when adjacent controls or ClipContents would cover or clip it.
Skew contains vertex-shear coefficients around drawing center, not degree angles or child-Control transforms. DrawCenter = false removes fill while allowing borders and shadow. BorderBlend blends the inner border edge towards BgColor, or transparency without fill. Rounded corners and a transparent center do not automatically change hit areas or clip children.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
StyleBoxFlatConstructor
public StyleBoxFlat();Creates a gray panel: DrawCenter and AntiAliasing enabled; borders/radii/shadow size/expansion/Skew zero; CornerDetail = 8, AntiAliasingSize = 1.
Properties23
AntiAliasingProperty
public bool AntiAliasing { get; set; }Local edge antialiasing, default true. Used only for rounded corners or nonzero Skew; disabling it retains AntiAliasingSize.
AntiAliasingSizeProperty
public float AntiAliasingSize { get; set; }Antialiasing feather width, default 1; setter clamps to 0.01–10. Drawing accounts for canvas scale; disabling antialiasing stores but does not apply this width.
BgColorProperty
public Color BgColor { get; set; }Fill color/alpha, default (0.6, 0.6, 0.6, 1). DrawCenter enables fill; BorderBlend also uses this color at the inner border edge.
BorderBlendProperty
public bool BorderBlend { get; set; }Blends BorderColor towards BgColor across border thickness; default false. With DrawCenter = false, the inner edge becomes transparent. Does not change width or padding.
BorderColorProperty
public Color BorderColor { get; set; }Border color/alpha, default (0.8, 0.8, 0.8, 1). Zero BorderWidth values produce no border.
BorderWidthBottomProperty
public int BorderWidthBottom { get; set; }Bottom border width in pixels, default 0. Use a nonnegative value; supplies automatic padding for this side when ContentMargin is negative.
BorderWidthLeftProperty
public int BorderWidthLeft { get; set; }Left border width in pixels, default 0. Use a nonnegative value; supplies automatic padding for this side when ContentMargin is negative.
BorderWidthRightProperty
public int BorderWidthRight { get; set; }Right border width in pixels, default 0. Use a nonnegative value; supplies automatic padding for this side when ContentMargin is negative.
BorderWidthTopProperty
public int BorderWidthTop { get; set; }Top border width in pixels, default 0. Use a nonnegative value; supplies automatic padding for this side when ContentMargin is negative.
CornerDetailProperty
public int CornerDetail { get; set; }Segment count per rounded-corner arc; default 8, setter clamps to 1–20. Does not set radius, texture resolution or feather width.
CornerRadiusBottomLeftProperty
public int CornerRadiusBottomLeft { get; set; }Requested BottomLeft corner radius in pixels, default 0. Use a nonnegative value; drawing adapts to size without changing this property. Does not clip children.
CornerRadiusBottomRightProperty
public int CornerRadiusBottomRight { get; set; }Requested BottomRight corner radius in pixels, default 0. Use a nonnegative value; drawing adapts to size without changing this property. Does not clip children.
CornerRadiusTopLeftProperty
public int CornerRadiusTopLeft { get; set; }Requested TopLeft corner radius in pixels, default 0. Use a nonnegative value; drawing adapts to size without changing this property. Does not clip children.
CornerRadiusTopRightProperty
public int CornerRadiusTopRight { get; set; }Requested TopRight corner radius in pixels, default 0. Use a nonnegative value; drawing adapts to size without changing this property. Does not clip children.
DrawCenterProperty
public bool DrawCenter { get; set; }Draw fill, default true. false does not remove borders, shadow, padding or the Control input area.
ExpandMarginBottomProperty
public float ExpandMarginBottom { get; set; }Bottom drawing expansion in pixels, default 0. Does not increase padding or minimum size; use a finite value.
ExpandMarginLeftProperty
public float ExpandMarginLeft { get; set; }Left drawing expansion in pixels, default 0. Does not increase padding or minimum size; use a finite value.
ExpandMarginRightProperty
public float ExpandMarginRight { get; set; }Right drawing expansion in pixels, default 0. Does not increase padding or minimum size; use a finite value.
ExpandMarginTopProperty
public float ExpandMarginTop { get; set; }Top drawing expansion in pixels, default 0. Does not increase padding or minimum size; use a finite value.
ShadowColorProperty
public Color ShadowColor { get; set; }Decorative shadow color/alpha, default (0, 0, 0, 0.6). A positive ShadowSize is required to draw it.
ShadowOffsetProperty
public Vector2 ShadowOffset { get; set; }Shadow offset in local pixels, default Vector2.Zero. Does not move fill, borders, children or padding.
ShadowSizeProperty
public int ShadowSize { get; set; }Fading-shadow expansion in pixels; default 0 disables it. Use a nonnegative value. Does not reserve padding or set Gaussian blur.
SkewProperty
public Vector2 Skew { get; set; }Drawing vertex-shear coefficients, default Vector2.Zero: x adds -Skew.X × (y - centerY), y adds -Skew.Y × (x - centerX). These are not degree angles or child layout. Use finite values.
Methods32
GetAASizefloat
public float GetAASize();Antialiasing feather width, default 1; setter clamps to 0.01–10. Drawing accounts for canvas scale; disabling antialiasing stores but does not apply this width.
floatStored feather width in range 0.01–10.
GetBgColorColor
public Color GetBgColor();Fill color/alpha, default (0.6, 0.6, 0.6, 1). DrawCenter enables fill; BorderBlend also uses this color at the inner border edge.
ColorFill color/alpha.
GetBorderBlendbool
public bool GetBorderBlend();Blends BorderColor towards BgColor across border thickness; default false. With DrawCenter = false, the inner edge becomes transparent. Does not change width or padding.
booltrue when blending towards the inner color is enabled.
GetBorderColorColor
public Color GetBorderColor();Border color/alpha, default (0.8, 0.8, 0.8, 1). Zero BorderWidth values produce no border.
ColorBorder color/alpha.
GetBorderWidthint
public int GetBorderWidth(Side margin);Returns the requested border width for a side in pixels. Actual drawn thickness may be reduced in a small rectangle.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
marginSide.Left, Top, Right or Bottom.
intRequested side border width in pixels.
GetBorderWidthMinint
public int GetBorderWidthMin();Returns the smallest of four stored border widths. Does not return panel minimum Vector2 or account for ContentMargin.
intSmallest of four stored border widths.
GetCornerDetailint
public int GetCornerDetail();Segment count per rounded-corner arc; default 8, setter clamps to 1–20. Does not set radius, texture resolution or feather width.
intArc segment count, 1–20.
GetCornerRadiusint
public int GetCornerRadius(Corner corner);Returns the stored corner radius in pixels. Drawn radius may be adapted to available size.
| Name | Type | Default |
|---|---|---|
corner | Corner | — |
cornerCorner.TopLeft, TopRight, BottomRight or BottomLeft.
intRequested selected-corner radius in pixels.
GetExpandMarginfloat
public float GetExpandMargin(Side margin);Returns stored side drawing expansion in pixels rather than content padding.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
marginSide.Left, Top, Right or Bottom.
floatSelected-side drawing expansion in pixels.
GetShadowColorColor
public Color GetShadowColor();Decorative shadow color/alpha, default (0, 0, 0, 0.6). A positive ShadowSize is required to draw it.
ColorShadow color/alpha.
GetShadowOffsetVector2
public Vector2 GetShadowOffset();Shadow offset in local pixels, default Vector2.Zero. Does not move fill, borders, children or padding.
Vector2Shadow offset in local pixels.
GetShadowSizeint
public int GetShadowSize();Fading-shadow expansion in pixels; default 0 disables it. Use a nonnegative value. Does not reserve padding or set Gaussian blur.
intStored shadow expansion in pixels.
GetSkewVector2
public Vector2 GetSkew();Drawing vertex-shear coefficients, default Vector2.Zero: x adds -Skew.X × (y - centerY), y adds -Skew.Y × (x - centerX). These are not degree angles or child layout. Use finite values.
Vector2Vertex-shear coefficients (X, Y).
IsAntiAliasedbool
public bool IsAntiAliased();Local edge antialiasing, default true. Used only for rounded corners or nonzero Skew; disabling it retains AntiAliasingSize.
boolStored local antialiasing flag.
IsDrawCenterEnabledbool
public bool IsDrawCenterEnabled();Draw fill, default true. false does not remove borders, shadow, padding or the Control input area.
booltrue when center fill is enabled.
SetAASizevoid
public void SetAASize(float size);Antialiasing feather width, default 1; setter clamps to 0.01–10. Drawing accounts for canvas scale; disabling antialiasing stores but does not apply this width.
| Name | Type | Default |
|---|---|---|
size | float | — |
sizeAntialiasing feather width, default 1; setter clamps to 0.01–10. Drawing accounts for canvas scale; disabling antialiasing stores but does not apply this width.
SetAntiAliasedvoid
public void SetAntiAliased(bool antiAliased);Local edge antialiasing, default true. Used only for rounded corners or nonzero Skew; disabling it retains AntiAliasingSize.
| Name | Type | Default |
|---|---|---|
antiAliased | bool | — |
antiAliasedLocal edge antialiasing, default true. Used only for rounded corners or nonzero Skew; disabling it retains AntiAliasingSize.
SetBgColorvoid
public void SetBgColor(Color color);Fill color/alpha, default (0.6, 0.6, 0.6, 1). DrawCenter enables fill; BorderBlend also uses this color at the inner border edge.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorFill color/alpha, default (0.6, 0.6, 0.6, 1). DrawCenter enables fill; BorderBlend also uses this color at the inner border edge.
SetBorderBlendvoid
public void SetBorderBlend(bool blend);Blends BorderColor towards BgColor across border thickness; default false. With DrawCenter = false, the inner edge becomes transparent. Does not change width or padding.
| Name | Type | Default |
|---|---|---|
blend | bool | — |
blendBlends BorderColor towards BgColor across border thickness; default false. With DrawCenter = false, the inner edge becomes transparent. Does not change width or padding.
SetBorderColorvoid
public void SetBorderColor(Color color);Border color/alpha, default (0.8, 0.8, 0.8, 1). Zero BorderWidth values produce no border.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorBorder color/alpha, default (0.8, 0.8, 0.8, 1). Zero BorderWidth values produce no border.
SetBorderWidthvoid
public void SetBorderWidth(Side margin, int width);Sets side border width in pixels and emits Changed. Use a nonnegative value. Also changes padding/minimum when ContentMargin is automatic.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
width | int | — |
marginSide.Left, Top, Right or Bottom.
widthSets side border width in pixels and emits Changed. Use a nonnegative value. Also changes padding/minimum when ContentMargin is automatic.
SetBorderWidthAllvoid
public void SetBorderWidthAll(int width);Sets the same width on all four borders and emits Changed once. Explicit ContentMargin values are not overwritten.
| Name | Type | Default |
|---|---|---|
width | int | — |
widthSets the same width on all four borders and emits Changed once. Explicit ContentMargin values are not overwritten.
SetCornerDetailvoid
public void SetCornerDetail(int detail);Segment count per rounded-corner arc; default 8, setter clamps to 1–20. Does not set radius, texture resolution or feather width.
| Name | Type | Default |
|---|---|---|
detail | int | — |
detailSegment count per rounded-corner arc; default 8, setter clamps to 1–20. Does not set radius, texture resolution or feather width.
SetCornerRadiusvoid
public void SetCornerRadius(Corner corner, int radius);Sets selected-corner radius in pixels and emits Changed. Use a nonnegative value; minimum size and hit area do not grow.
| Name | Type | Default |
|---|---|---|
corner | Corner | — |
radius | int | — |
cornerCorner.TopLeft, TopRight, BottomRight or BottomLeft.
radiusSets selected-corner radius in pixels and emits Changed. Use a nonnegative value; minimum size and hit area do not grow.
SetCornerRadiusAllvoid
public void SetCornerRadiusAll(int radius);Sets one radius on all four corners and emits Changed once. Drawing fits curves to the rectangle without changing stored radii.
| Name | Type | Default |
|---|---|---|
radius | int | — |
radiusSets one radius on all four corners and emits Changed once. Drawing fits curves to the rectangle without changing stored radii.
SetDrawCentervoid
public void SetDrawCenter(bool drawCenter);Draw fill, default true. false does not remove borders, shadow, padding or the Control input area.
| Name | Type | Default |
|---|---|---|
drawCenter | bool | — |
drawCenterDraw fill, default true. false does not remove borders, shadow, padding or the Control input area.
SetExpandMarginvoid
public void SetExpandMargin(Side margin, float size);Sets drawing overflow beyond a rect side in pixels and emits Changed. Positive values expand drawing without increasing minimum size; use a finite value.
| Name | Type | Default |
|---|---|---|
margin | Side | — |
size | float | — |
marginSide.Left, Top, Right or Bottom.
sizeSets drawing overflow beyond a rect side in pixels and emits Changed. Positive values expand drawing without increasing minimum size; use a finite value.
SetExpandMarginAllvoid
public void SetExpandMarginAll(float size);Sets one drawing expansion on all sides and emits Changed once. The container does not reserve this area; use a finite value.
| Name | Type | Default |
|---|---|---|
size | float | — |
sizeSets one drawing expansion on all sides and emits Changed once. The container does not reserve this area; use a finite value.
SetShadowColorvoid
public void SetShadowColor(Color color);Decorative shadow color/alpha, default (0, 0, 0, 0.6). A positive ShadowSize is required to draw it.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorDecorative shadow color/alpha, default (0, 0, 0, 0.6). A positive ShadowSize is required to draw it.
SetShadowOffsetvoid
public void SetShadowOffset(Vector2 offset);Shadow offset in local pixels, default Vector2.Zero. Does not move fill, borders, children or padding.
| Name | Type | Default |
|---|---|---|
offset | Vector2 | — |
offsetShadow offset in local pixels, default Vector2.Zero. Does not move fill, borders, children or padding.
SetShadowSizevoid
public void SetShadowSize(int size);Fading-shadow expansion in pixels; default 0 disables it. Use a nonnegative value. Does not reserve padding or set Gaussian blur.
| Name | Type | Default |
|---|---|---|
size | int | — |
sizeFading-shadow expansion in pixels; default 0 disables it. Use a nonnegative value. Does not reserve padding or set Gaussian blur.
SetSkewvoid
public void SetSkew(Vector2 skew);Drawing vertex-shear coefficients, default Vector2.Zero: x adds -Skew.X × (y - centerY), y adds -Skew.Y × (x - centerX). These are not degree angles or child layout. Use finite values.
| Name | Type | Default |
|---|---|---|
skew | Vector2 | — |
skewDrawing vertex-shear coefficients, default Vector2.Zero: x adds -Skew.X × (y - centerY), y adds -Skew.Y × (x - centerX). These are not degree angles or child layout. Use finite values.