1
1. 在home画面中创建三个按钮,背景色改成需要修改成的背景色
我们这里使用红 绿 蓝三种颜色
2
2.新建int类型的内部变量colornumber,在按钮的单击事件中添加如下脚本
3
3.设置变量为系统自带的脚本,我们还需建一个changebackgroundcolor脚本来根据colornumber的值来改变画面的背景色。
sub changebackgroundcolor()'提示:' 1. 使用' 2. 使用 hmi runtime 对象写入代码。' 示例:hmiruntime.screens("screen_1")。' 3. 使用'从此位置起写入代码:
select case smarttags("colornumber") case 0 hmiruntime.screens("home").backcolor=rgb(255,0,0) case 1 hmiruntime.screens("home").backcolor=rgb(0,255,0) case 2 hmiruntime.screens("home").backcolor=rgb(0,0,255) end select
end sub
4
4.效果如图
西门一级代理商,西门子代理商,西门子变频器,西门子PLC,西门子伺服电机