当前位置:网站首页>Aardio - 利用customPlus库+plus构造一个多按钮组件
Aardio - 利用customPlus库+plus构造一个多按钮组件
2022-07-06 14:39:00 【卢光庆】
利用customPlus库+plus组件,轻松构造一个多按钮组件,实现鼠标悬停效果,实现响应点击功能。
效果一:
代码一:
import win.ui;
/*DSG{
{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
plus={cls="plus";left=0;top=0;right=600;bottom=500;bgcolor=16777215;notify=1;z=1}
)
/*}}*/
winform.show();
// 定义项目模板
var itemModel = {
{
type="rect",
rectf={x=3;y=3;width=-3;height=-3},
name="项目背景色",
click=true;
width=1,
round=25,
color=0xFF009955,
fillcolor=0x22009955,
itemhoverfillcolor=0xAA009955,
},
{
type="text",
rectf={x=3;y=3;width=-3;height=-3},
name="标题文字",
align=1;
valign=1;
smooth=true;
text="",
font={name="Tahoma",h=-13,color=0xFFFF0000,weight=700},
itemhoverfont={name="Tahoma",h=-16,color=0xFFFFFFFF,weight=700},
}
}
//生成项目列表
var itemList = {}
for(i=1;28;1){
..table.push(itemList,{标题文字="ITEM"++i})
}
//构造组件
import godking.customPlus
var c = godking.customPlus(winform.plus,{
itemWidth=80, /*项目宽度*/
itemHeight=40, /*项目高度*/
autoSizeRow=true, /*自动根据项目行数及plus高度调整项目高度*/
autoSizeCol=true, /*自动根据项目列数及plus宽度调整项目宽度*/
colnum=0, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=0, /*项目行数,为0则根据项目高度和plus高度自动计算*/
padLeft=5, /*plus左边空白距离*/
padTop=5, /*plus顶边空白距离*/
padRight=5, /*plus右边空白距离*/
padBottom=5 /*plus底边空白距离*/
},itemModel,itemList);
c.onClick = function(itemIndex){
..win.msgbox("您点击了:"++itemIndex)
}
win.loopMessage();
效果二:
代码二:
import win.ui;
/*DSG{
{*/
var winform = win.form(text="aardio form";right=669;bottom=399)
winform.add(
button={cls="button";text="添加";left=530;top=330;right=660;bottom=390;color=14120960;flat=1;font=LOGFONT(h=-14);note="添加一个项目";z=2};
plus={cls="plus";left=0;top=0;right=670;bottom=320;clipBk=false;notify=1;z=1}
)
/*}}*/
winform.show();
import inet.http
winform.plus.background = "https://img1.baidu.com/it/u=3977836567,3094831983&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
// 定义项目模板
var itemModel = {
{
type="rect",
rectf={x=3;y=3;width=-3;height=-3},
name="项目背景色",
click=true;
width=2,
round=4,
color=0xFF009955,
fillcolor=0x55009955,
hoverfillcolor=0xBB009955,
},
{
type="text",
rectf={x=3;y=3;width=-3;height=-3},
name="标题文字",
align=1;
valign=1;
smooth=true;
text="",
font={name="Tahoma",h=-13,color=0xFFFFFFFF,weight=700},
hoverfont={name="Tahoma",h=-16,color=0xFFFFFF00,weight=700},
}
}
//生成项目列表
var itemList = {}
for(i=1;28;1){
..table.push(itemList,{标题文字="ITEM"++i})
}
//构造组件
import godking.customPlus
var c = godking.customPlus(winform.plus,{
itemWidth=80, /*项目宽度*/
itemHeight=40, /*项目高度*/
autoSizeRow=true, /*自动根据项目行数及plus高度调整项目高度*/
autoSizeCol=true, /*自动根据项目列数及plus宽度调整项目宽度*/
colnum=0, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=0, /*项目行数,为0则根据项目高度和plus高度自动计算*/
padLeft=20, /*plus左边空白距离*/
padTop=20, /*plus顶边空白距离*/
padRight=20, /*plus右边空白距离*/
padBottom=20 /*plus底边空白距离*/
},itemModel,itemList);
c.onClick = function(itemIndex){
..win.msgbox("您点击了:"++itemIndex)
}
winform.button.oncommand = function(id,event){
..table.push(itemList,{标题文字="ITEM"++(#itemList+1)})
c.update()
}
win.loopMessage();
效果三:
代码三:
import win.ui;
/*DSG{
{*/
var winform = win.form(text="aardio form";right=669;bottom=399)
winform.add(
button={cls="button";text="添加";left=530;top=330;right=660;bottom=390;color=14120960;db=1;dr=1;flat=1;font=LOGFONT(h=-14);note="添加一个项目";z=2};
plus={cls="plus";left=0;top=0;right=670;bottom=320;clipBk=false;db=1;dl=1;dr=1;dt=1;notify=1;z=1}
)
/*}}*/
winform.show();
import inet.http
// 定义项目模板
var itemModel = {
{
type="rect",
rectf={x=23;y=3;width=-3;height=-3},
name="项目背景色",
click=true;
width=0,
round=50,
color=0xFF009955,
fillcolor=0x55009955,
hoverfillcolor=0xBB009955,
},
{
type="text",
rectf={x=30;y=3;width=-3;height=-3},
name="标题文字",
align=1;
valign=1;
smooth=true;
text="",
font={name="Tahoma",h=-13,color=0xFFFFFFFF,weight=700},
hoverfont={name="Tahoma",h=-16,color=0xFFFFFF00,weight=700},
}
{
type="img",
rectf={x=0;y=0;width=50;height=50},
scale = true;
name="cio",
img = "//img.inotgo.com/imagesLocal/202207/06/202207061439346027_0.png"
}
}
//生成项目列表
var itemList = {}
for(i=1;580;1){
..table.push(itemList,{标题文字="ITEM"++i})
}
//构造组件
import godking.customPlus
var c = godking.customPlus(winform.plus,{
itemWidth=150, /*项目宽度*/
itemHeight=50, /*项目高度*/
autoSizeRow=true, /*自动根据项目行数及plus高度调整项目高度*/
autoSizeCol=true, /*自动根据项目列数及plus宽度调整项目宽度*/
colnum=0, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=0, /*项目行数,为0则根据项目高度和plus高度自动计算*/
padLeft=20, /*plus左边空白距离*/
padTop=20, /*plus顶边空白距离*/
padRight=20, /*plus右边空白距离*/
padBottom=20 /*plus底边空白距离*/
},itemModel,itemList,0xFF000000,);
c.onClick = function(itemIndex){
..win.msgbox("您点击了:"++itemIndex)
}
winform.button.oncommand = function(id,event){
..table.push(itemList,{标题文字="ITEM"++(#itemList+1)})
c.update()
}
winform.adjust = function( cx,cy,wParam ) {
c.init()
};
c.toNextPage()
win.loopMessage();
效果四:
代码四:
import win.ui;
/*DSG{
{*/
var winform = win.form(text="aardio form";right=669;bottom=399)
winform.add(
button={cls="button";text="添加";left=530;top=330;right=660;bottom=390;color=14120960;db=1;dr=1;flat=1;font=LOGFONT(h=-14);note="添加一个项目";z=2};
plus={cls="plus";left=0;top=0;right=670;bottom=320;clipBk=false;db=1;dl=1;dr=1;dt=1;notify=1;z=1}
)
/*}}*/
winform.show();
import inet.http
// 定义项目模板
var itemModel = {
{
type="rect",
rectf={x=3;y=3;width=-3;height=-3},
name="项目背景色",
click=true;
width=2,
round=4,
color=0xFF009955,
fillcolor=0x55009955,
hoverfillcolor=0xBB009955,
},
{
type="text",
rectf={x=20;y=3;width=-3;height=-3},
name="标题文字",
align=1;
valign=1;
smooth=true;
text="",
font={name="Tahoma",h=-13,color=0xFFFFFFFF,weight=700},
hoverfont={name="Tahoma",h=-16,color=0xFFFFFF00,weight=700},
}
{
type="img",
rectf={x=10;y=10;width=30;height=30},
scale = true;
name="cio",
img = "//img.inotgo.com/imagesLocal/202207/06/202207061439346027_0.png"
}
}
//生成项目列表
var itemList = {}
for(i=1;580;1){
..table.push(itemList,{标题文字="ITEM"++i})
}
//构造组件
import godking.customPlus
var c = godking.customPlus(winform.plus,{
itemWidth=150, /*项目宽度*/
itemHeight=50, /*项目高度*/
autoSizeRow=true, /*自动根据项目行数及plus高度调整项目高度*/
autoSizeCol=true, /*自动根据项目列数及plus宽度调整项目宽度*/
colnum=0, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=0, /*项目行数,为0则根据项目高度和plus高度自动计算*/
padLeft=20, /*plus左边空白距离*/
padTop=20, /*plus顶边空白距离*/
padRight=20, /*plus右边空白距离*/
padBottom=20 /*plus底边空白距离*/
},itemModel,itemList,0xFF000000,);
c.onClick = function(itemIndex){
..win.msgbox("您点击了:"++itemIndex)
}
winform.button.oncommand = function(id,event){
..table.push(itemList,{标题文字="ITEM"++(#itemList+1)})
c.update()
}
winform.adjust = function( cx,cy,wParam ) {
c.init()
};
c.toNextPage()
win.loopMessage();
使用的图像:
效果五:
代码五:
import win.ui;
/*DSG{
{*/
var winform = win.form(text="aardio form";right=639;bottom=399)
winform.add(
button={cls="button";text="添加";left=500;top=330;right=630;bottom=390;color=14120960;db=1;dr=1;flat=1;font=LOGFONT(h=-14);note="添加一个项目";z=2};
plus={cls="plus";left=0;top=0;right=650;bottom=320;clipBk=false;db=1;dl=1;dr=1;dt=1;notify=1;z=1}
)
/*}}*/
winform.show();
// 定义项目模板
var itemModel = {
{
type="rect",
rectf={x=0;y=0;width=151;height=51},
name="项目背景色",
click=true;
width=0,
round=0, // 或1
color=0xBB009955;
fillcolor=0x55009955,
hoverfillcolor=0xBB009955,
},
{
type="text",
rectf={x=20;y=3;width=-3;height=-3},
name="标题文字",
align=1;
valign=1;
smooth=true;
text="",
font={name="Tahoma",h=-13,color=0xFFFFFFFF,weight=700},
hoverfont={name="Tahoma",h=-16,color=0xFFFFFF00,weight=700},
}
{
type="img",
name = "pic",
rectf={x=10;y=10;width=30;height=30},
scale = true;
}
}
//生成项目列表
var itemList = {}
for(i=1;580;1){
..table.push(itemList,{标题文字="ITEM"++i;pic="E:\图片素材\png\png128_1000\"++i++".png"})
}
//构造组件
import godking.customPlus
var c = godking.customPlus(winform.plus,{
itemWidth=150, /*项目宽度*/
itemHeight=50, /*项目高度*/
autoSizeRow=0, /*自动根据项目行数及plus高度调整项目高度*/
autoSizeCol=0, /*自动根据项目列数及plus宽度调整项目宽度*/
colnum=0, /*项目列数,为0则根据项目宽度和plus宽度自动计算*/
rownum=0, /*项目行数,为0则根据项目高度和plus高度自动计算*/
padLeft=20, /*plus左边空白距离*/
padTop=20, /*plus顶边空白距离*/
padRight=20, /*plus右边空白距离*/
padBottom=20 /*plus底边空白距离*/
},itemModel,itemList,0xFF000000,);
c.onClick = function(itemIndex/*项目索引*/,elemIndex/*元素索引*/,elemID/*元素id*/,elemName/*元素name*/,pageIndex/*当前页项目索引*/){
..win.msgbox("您点击了:"++c.itemList[itemIndex].标题文字)
}
winform.button.oncommand = function(id,event){
..table.push(itemList,{标题文字="ITEM"++(#itemList+1)})
c.update()
}
winform.adjust = function( cx,cy,wParam ) {
c.init()
};
c.toNextPage()
win.loopMessage();
边栏推荐
- OpenCV VideoCapture. Get() parameter details
- Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
- C # realizes crystal report binding data and printing 4-bar code
- GPS從入門到放弃(十三)、接收機自主完好性監測(RAIM)
- GPS from entry to abandonment (XIV), ionospheric delay
- 第3章:类的加载过程(类的生命周期)详解
- 网络基础入门理解
- GPS from getting started to giving up (19), precise ephemeris (SP3 format)
- pytorch_YOLOX剪枝【附代码】
- Attack and defense world miscall
猜你喜欢
基於 QEMUv8 搭建 OP-TEE 開發環境
网络基础入门理解
Leetcode question brushing (XI) -- sequential questions brushing 51 to 55
GPS from entry to abandonment (XIV), ionospheric delay
ZABBIX proxy server and ZABBIX SNMP monitoring
GPS from getting started to giving up (16), satellite clock error and satellite ephemeris error
NPDP认证|产品经理如何跨职能/跨团队沟通?
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
Daily question 1: force deduction: 225: realize stack with queue
Heavyweight news | softing fg-200 has obtained China 3C explosion-proof certification to provide safety assurance for customers' on-site testing
随机推荐
网络基础入门理解
GPS from entry to abandonment (XIV), ionospheric delay
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
What are the interface tests? What are the general test points?
图像的spatial domain 和 frequency domain 图像压缩
Oracle Performance Analysis 3: introduction to tkprof
[MySQL] online DDL details
Unity3D学习笔记6——GPU实例化(1)
2022-07-05 stonedb的子查询处理解析耗时分析
GD32F4XX串口接收中断和闲时中断配置
MariaDB database management system learning (I) installation diagram
Barcodex (ActiveX print control) v5.3.0.80 free version
0 basic learning C language - digital tube
小常识:保险中的“保全”是什么?
[leetcode daily clock in] 1020 Number of enclaves
Search element topic (DFS)
Classic sql50 questions
Unity3d minigame unity webgl transform plug-in converts wechat games to use dlopen, you need to use embedded 's problem
微信红包封面小程序源码-后台独立版-带测评积分功能源码
The nearest common ancestor of binary (search) tree ●●