Customizable Stylebox with a given set of parameters. (no texture required)
    public class StyleBoxFlat : StyleBox

This stylebox can be used to achieve all kinds of looks without the need of a texture. Those properties are customizable:

  • Color

  • Border width (individual width for each border)

  • Rounded corners (individual radius for each corner)

  • Shadow

Setting corner radius to high values is allowed. As soon as corners would overlap, the stylebox will switch to a relative system. Example:

[codeblock]

height = 30

corner_radius_top_left = 50

corner_radius_bottom_left = 100

[/codeblock]

The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will never be more than the height. Result:

[codeblock]

corner_radius_top_left: 10

corner_radius_bottom_left: 20

[/codeblock]

Inheritance Chain

Constructors

    public StyleBoxFlat()

Properties

    public bool AntiAliasing { get; set; }

Antialiasing draws a small ring around the edges, which fades to transparency. As a result, edges look much smoother. This is only noticeable when using rounded corners.

    public int AntiAliasingSize { get; set; }

This changes the size of the faded ring. Higher values can be used to achieve a “blurry” effect.

    public Color BgColor { get; set; }

The background color of the stylebox.

    public bool BorderBlend { get; set; }

If true, the border will fade into the background color.

    public Color BorderColor { get; set; }

Sets the color of the border.

    public int BorderWidthBottom { get; set; }

Border width for the bottom border.

    public int BorderWidthLeft { get; set; }

Border width for the left border.

    public int BorderWidthRight { get; set; }

Border width for the right border.

    public int BorderWidthTop { get; set; }

Border width for the top border.

    public int CornerDetail { get; set; }

This sets the amount of vertices used for each corner. Higher values result in rounder corners but take more processing power to compute. When choosing a value, you should take the corner radius (SetCornerRadiusAll(int)) into account.

For corner radii smaller than 10, 4-5 should be enough. For corner radii smaller than 30, 8-12 should be enough.

    public int CornerRadiusBottomLeft { get; set; }

The bottom-left corner’s radius. If 0, the corner is not rounded.

    public int CornerRadiusBottomRight { get; set; }

The bottom-right corner’s radius. If 0, the corner is not rounded.

    public int CornerRadiusTopLeft { get; set; }

The top-left corner’s radius. If 0, the corner is not rounded.

    public int CornerRadiusTopRight { get; set; }

The top-right corner’s radius. If 0, the corner is not rounded.

    public bool DrawCenter { get; set; }

Toggles drawing of the inner part of the stylebox.

    public float ExpandMarginBottom { get; set; }

Expands the stylebox outside of the control rect on the bottom edge. Useful in combination with BorderWidthBottom to draw a border outside the control rect.

    public float ExpandMarginLeft { get; set; }

Expands the stylebox outside of the control rect on the left edge. Useful in combination with BorderWidthLeft to draw a border outside the control rect.

    public float ExpandMarginRight { get; set; }

Expands the stylebox outside of the control rect on the right edge. Useful in combination with BorderWidthRight to draw a border outside the control rect.

    public float ExpandMarginTop { get; set; }

Expands the stylebox outside of the control rect on the top edge. Useful in combination with BorderWidthTop to draw a border outside the control rect.

    public Color ShadowColor { get; set; }

The color of the shadow. This has no effect if ShadowSize is lower than 1.

    public Vector2 ShadowOffset { get; set; }

The shadow offset in pixels. Adjusts the position of the shadow relatively to the stylebox.

    public int ShadowSize { get; set; }

The shadow size in pixels.

Methods

    [Obsolete("GetAaSize is deprecated. Use the AntiAliasingSize property instead.")]
    public int GetAaSize()

Getter for AntiAliasingSize

    [Obsolete("GetBgColor is deprecated. Use the BgColor property instead.")]
    public Color GetBgColor()

Getter for BgColor

    [Obsolete("GetBorderBlend is deprecated. Use the BorderBlend property instead.")]
    public bool GetBorderBlend()

Getter for BorderBlend

    [Obsolete("GetBorderColor is deprecated. Use the BorderColor property instead.")]
    public Color GetBorderColor()

Getter for BorderColor

    [Obsolete("GetBorderWidth is deprecated. Use the BorderWidthBottom property instead.")]
    public int GetBorderWidth(Margin margin)

    public int GetBorderWidthMin()

    [Obsolete("GetCornerDetail is deprecated. Use the CornerDetail property instead.")]
    public int GetCornerDetail()

Getter for CornerDetail

    [Obsolete("GetCornerRadius is deprecated. Use the CornerRadiusBottomLeft property instead.")]
    public int GetCornerRadius(Corner corner)

    [Obsolete("GetExpandMargin is deprecated. Use the ExpandMarginBottom property instead.")]
    public float GetExpandMargin(Margin margin)

    [Obsolete("GetShadowColor is deprecated. Use the ShadowColor property instead.")]
    public Color GetShadowColor()

Getter for ShadowColor

    [Obsolete("GetShadowOffset is deprecated. Use the ShadowOffset property instead.")]
    public Vector2 GetShadowOffset()

Getter for ShadowOffset

    [Obsolete("GetShadowSize is deprecated. Use the ShadowSize property instead.")]
    public int GetShadowSize()

Getter for ShadowSize

    [Obsolete("IsAntiAliased is deprecated. Use the AntiAliasing property instead.")]
    public bool IsAntiAliased()

Getter for AntiAliasing

    [Obsolete("IsDrawCenterEnabled is deprecated. Use the DrawCenter property instead.")]
    public bool IsDrawCenterEnabled()

Getter for DrawCenter

    [Obsolete("SetAaSize is deprecated. Use the AntiAliasingSize property instead.")]
    public void SetAaSize(int size)

Setter for AntiAliasingSize

    [Obsolete("SetAntiAliased is deprecated. Use the AntiAliasing property instead.")]
    public void SetAntiAliased(bool antiAliased)

Setter for AntiAliasing

    [Obsolete("SetBgColor is deprecated. Use the BgColor property instead.")]
    public void SetBgColor(Color color)

Setter for BgColor

    [Obsolete("SetBorderBlend is deprecated. Use the BorderBlend property instead.")]
    public void SetBorderBlend(bool blend)

Setter for BorderBlend

    [Obsolete("SetBorderColor is deprecated. Use the BorderColor property instead.")]
    public void SetBorderColor(Color color)

Setter for BorderColor

    [Obsolete("SetBorderWidth is deprecated. Use the BorderWidthBottom property instead.")]
    public void SetBorderWidth(Margin margin, int width)

    public void SetBorderWidthAll(int width)

    [Obsolete("SetCornerDetail is deprecated. Use the CornerDetail property instead.")]
    public void SetCornerDetail(int detail)

Setter for CornerDetail

    [Obsolete("SetCornerRadius is deprecated. Use the CornerRadiusBottomLeft property instead.")]
    public void SetCornerRadius(Corner corner, int radius)

    public void SetCornerRadiusAll(int radius)

    public void SetCornerRadiusIndividual(int radiusTopLeft, int radiusTopRight, int radiusBottomRight, int radiusBottomLeft)

    [Obsolete("SetDrawCenter is deprecated. Use the DrawCenter property instead.")]
    public void SetDrawCenter(bool drawCenter)

Setter for DrawCenter

    [Obsolete("SetExpandMargin is deprecated. Use the ExpandMarginBottom property instead.")]
    public void SetExpandMargin(Margin margin, float size)

    public void SetExpandMarginAll(float size)

    public void SetExpandMarginIndividual(float sizeLeft, float sizeTop, float sizeRight, float sizeBottom)

    [Obsolete("SetShadowColor is deprecated. Use the ShadowColor property instead.")]
    public void SetShadowColor(Color color)

Setter for ShadowColor

    [Obsolete("SetShadowOffset is deprecated. Use the ShadowOffset property instead.")]
    public void SetShadowOffset(Vector2 offset)

Setter for ShadowOffset

    [Obsolete("SetShadowSize is deprecated. Use the ShadowSize property instead.")]
    public void SetShadowSize(int size)

Setter for ShadowSize

Tags: