Skip to content

形状-Shape

描述


形状,父对象为ui,无子对象

事件


onUserEvent:接收自定义事件,当订阅了某自定义事件,通过service.emitEvent(name, value)广播时触发。

属性


名称功能说明脚本例子
xx坐标 (只读属性)var x = ui.form-name.shape-name.x; 获取对象的x坐标
yy坐标 (只读属性)var y = ui.form-name.shape-name.y; 获取对象的y坐标
width宽 (只读属性)var width = ui.form-name.shape-name.width; 获取对象的宽
height高 (只读属性)var height = ui.form-name.shape-name.width; 获取对象的高
enabled使能:如果选中,对象处于激活状态,否则处于“禁止”状态,对所有触摸操作无反应。ui.form-name.shape-name.enabled=0 禁止对象
visible可见:如果选中,对象可见,否则隐藏ui.form-name.shape-name.visible=0 隐藏对象
type类型:0-Line,1-Rectangle,2-Ellipse,3-Triangleui.form-name.shape-name.type=0 设置形状为线
lineEndAStyle线端点A风格:0-No_Style, 1-Arrow, 2-Square, 3-Circleui.form-name.shape-name.lineEndAStyle=1 设置端点A为箭头
lineEndBStyle线端点B风格:0-No_Style, 1-Arrow, 2-Square, 3-Circleui.form-name.shape-name.lineEndBStyle=1 设置端点B为箭头
cornerRadius圆角半径,单位:像素ui.form-name.shape-name.cornerRadius=10 设置圆角半径为10像素
direction方向:0-Clock_12, 1-Clock_3, 2-Clock_6, 3-Clock_9ui.form-name.shape-name.direction=1 设置图形的方向为3点种方向
lineStyle线风格:0-No_Pen, 1-Solid, 2-Dash, 3-Dot, 4-Dash-Dot, 5-DashDotDotui.form-name.shape-name.lineStyle=1 设置图形线为实线
lineWeight线粗,单位:像素ui.form-name.shape-name.lineWeight=10 设置线粗10像素
lineColor线颜色,颜色定义参看 控件对象ui.form-name.shape-name.lineColor='#0000ff' 设置线为蓝色
fillingColor填充颜色,颜色定义参看 控件对象ui.form-name.shape-name.fillingColor='#ff0000' 设置填充色为红色
fillingColorType填充色类型:0-Linear_A, 1-Linear_B, 2-Radial_A, 3-Radial_B, 4-Radial_Center, 5-Pure, 6-No_Color可选ui.form-name.shape-name.fillingColorType=0 设置填充色类型为Linear_A
antiAliasing反锯齿显示ui.form-name.shape-name.antiAliasing=1 使能反锯齿显示
effect
显示效果:0-None, 1-Shadow, 2-Blurui.form-name.shape-name.effect=1 显示效果为Shadow
blurRadius模糊半径ui.form-name.shape-name.blurRadius=2 设置模糊半径为2

方法


名称功能说明脚本例子
move(x,y)移动对象:将对象移动到(x,y)坐标位置,坐标系的原点在屏幕的左上角。ui.form-name.shape-name.move(10,10) 移动对象到坐标(10,10)
resize(width, height)
设置对象宽和高
ui.form-name.shape-name.resize(30,20) 设置对象宽30像素,高20像素