StyleBoxFlat

Inherits: StyleBox < Resource < Reference < Object

类别: 核心

简要说明

带有给定参数集的可定制样式框。(无需纹理)

方法

int

get_border_width ( Margin margin ) const

int

get_border_width_min ( ) const

int

get_corner_radius ( Corner corner ) const

float

get_expand_margin ( Margin margin ) const

无效

set_border_width ( Margin margin, int width )

无效

set_border_width_all ( int width )

无效

set_corner_radius ( Corner corner, int radius )

无效

set_corner_radius_all ( int radius )

无效

set_corner_radius_individual ( int radius_top_left, int radius_top_right, int radius_bottom_right, int radius_bottom_left )

无效

set_expand_margin ( Margin margin, float size )

无效

set_expand_margin_all ( float size )

无效

set_expand_margin_individual ( float size_left, float size_top, float size_right, float size_bottom )

描述

这个样式框可以用来实现各种外观,而不需要纹理。这些属性是可自定义的:

  • 颜色

  • 边框宽度(每个边框的单独宽度)

  • 圆角(每个角的单独半径)

  • 阴影

允许将角半径设置为高值。一旦角点重叠,样式框将切换到相对系统。例子:

height = 30
corner_radius_top_left = 50
corner_radius_bottom_left = 100

现在,相对系统将采用两个左角的1:2比率来计算实际的角宽度。添加的两个角将 从未 超过高度。结果:

corner_radius_top_left: 10
corner_radius_bottom_left: 20

属性描述

  • bool anti_aliasing

违约

设定器

设置“消除混叠”(值)

吸气剂

_anti_别名())

反锯齿在边缘周围绘制一个小圆环,该圆环将淡入透明度。因此,边缘看起来更平滑。这只在使用圆角时才明显。

  • int anti_aliasing_size

违约

1

设定器

设置大小(值)

吸气剂

获取u aa u大小()

这会改变褪色环的尺寸。较高的值可用于实现“模糊”效果。

违约

颜色(0.6、0.6、0.6、1)

设定器

设置颜色(值)

吸气剂

获取颜色

样式框的背景色。

违约

设定器

设置边框混合(值)

吸气剂

获取_border_blend()

如果 true ,边框将淡入背景色。

违约

颜色(0.8、0.8、0.8、1)

设定器

设置边框颜色(值)

吸气剂

获取边框颜色()

设置边框的颜色。

  • int border_width_bottom

违约

0

设定器

设置边框宽度(值)

吸气剂

获取“边框宽度”()

下边框的边框宽度。

  • int border_width_left

违约

0

设定器

设置边框宽度(值)

吸气剂

获取“边框宽度”()

左边框的边框宽度。

  • int border_width_right

违约

0

设定器

设置边框宽度(值)

吸气剂

获取“边框宽度”()

右边框的边框宽度。

  • int border_width_top

违约

0

设定器

设置边框宽度(值)

吸气剂

获取“边框宽度”()

上边框的边框宽度。

  • int corner_detail

违约

8

设定器

设置角细节(值)

吸气剂

获取角点细节()。

这将设置用于每个角点的顶点数量。值越大,角越圆,但需要更多的处理能力来计算。选择值时,应取拐角半径 (set_corner_radius_all )考虑。

对于小于10的角半径,4-5应该足够。对于小于30的角半径,8-12应该足够。

  • int corner_radius_bottom_left

违约

0

设定器

设置角半径(值)

吸气剂

得到角半径

左下角的半径。如果 0 ,角不圆。

  • int corner_radius_bottom_right

违约

0

设定器

设置角半径(值)

吸气剂

得到角半径

右下角的半径。如果 0 ,角不圆。

  • int corner_radius_top_left

违约

0

设定器

设置角半径(值)

吸气剂

得到角半径

左上角的半径。如果 0 ,角不圆。

  • int corner_radius_top_right

违约

0

设定器

设置角半径(值)

吸气剂

得到角半径

右上角的半径。如果 0 ,角不圆。

违约

设定器

设置绘制中心(值)

吸气剂

是否启用了“绘制中心”()

切换样式框内部的绘图。

  • float expand_margin_bottom

违约

0.0

设定器

设置“展开”边距(值)

吸气剂

获取扩展页边距()。

在下边缘的控件矩形外展开样式框。与…结合使用 border_width_bottom 在控件矩形外绘制边框。

  • float expand_margin_left

违约

0.0

设定器

设置“展开”边距(值)

吸气剂

获取扩展页边距()。

在控件矩形的左边缘展开样式框。与…结合使用 border_width_left 在控件矩形外绘制边框。

  • float expand_margin_right

违约

0.0

设定器

设置“展开”边距(值)

吸气剂

获取扩展页边距()。

在右边缘的控件矩形外展开样式框。与…结合使用 border_width_right 在控件矩形外绘制边框。

  • float expand_margin_top

违约

0.0

设定器

设置“展开”边距(值)

吸气剂

获取扩展页边距()。

在上边缘的控件矩形外展开样式框。与…结合使用 border_width_top 在控件矩形外绘制边框。

违约

颜色(0,0,0,0.6)

设定器

设置阴影颜色(值)

吸气剂

获取阴影颜色()

阴影的颜色。如果 shadow_size 小于1。

违约

矢量2(0,0)

设定器

设置阴影偏移(值)

吸气剂

获取阴影偏移量()

阴影偏移(像素)。相对于样式框调整阴影的位置。

  • int shadow_size

违约

0

设定器

设置阴影大小(值)

吸气剂

获取阴影大小()。

阴影大小(像素)。

方法说明

  • int get_border_width ( Margin margin ) const

  • int get_border_width_min ( ) const

  • int get_corner_radius ( Corner corner ) const

  • void set_border_width ( Margin margin, int width )

  • void set_border_width_all ( int width )

  • void set_corner_radius ( Corner corner, int radius )

  • void set_corner_radius_all ( int radius )

  • void set_corner_radius_individual ( int radius_top_left, int radius_top_right, int radius_bottom_right, int radius_bottom_left )

  • void set_expand_margin_all ( float size )

  • void set_expand_margin_individual ( float size_left, float size_top, float size_right, float size_bottom )