请更新虚表到最新版。
import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=639;bottom=647)
mainForm.add(
vlist={cls="vlistEx";left=8;top=8;right=632;bottom=640;border=1;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
mainForm.show()
//创建图片数据
import godking.paint
import inet.http
var imgs = godking.paint.splitImage("https://aardio.online/upload/files/20250124/1737707732.png",5,5,0,0,0,0)
for(i=1;#imgs;1){
mainForm.vlist.addImg("pic"++i/*图片名称*/,imgs[i]/*图片文件*/,false/*是否替换*/,/*宽度*/,/*高度*/);
}
//填充虚表数据
var t = {};
for(i=1;33;1){
var name =..string.random(3,"赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎");
for(n=1;3;1){
var tt = {name};
..table.push(tt,({"<img name='pic14',w=14,h=14> 技能","<img name='pic12',w=14,h=14> 服务","<img name='pic13',w=14,h=14> 业绩"})[n]);
for(n=1;12;1){
..table.push(tt,..string.format("%.2d",..math.random(0,99)));
}
..table.push(t,tt);
}
}
mainForm.vlist.setTable(t);
mainForm.vlist.setRowHeight(30);
mainForm.vlist.onResizeCol = false;
//虚表表头设置
mainForm.vlist.headerFont = ::LOGFONT(name="宋体";h=14;);
mainForm.vlist.headerBkcolor = 0xE0FFFF;
mainForm.vlist.setHeaderEx(
text = {{"<img name='pic6',w=20,h=20> 姓名" ,"<img name='pic9',w=20,h=20> 类型" ,"<img name='pic17',w=30,h=30> 2024年度绩效考核成绩明细表","-","-","-","-","-","-","-","-","-","-","-"}
{"|" ,"|" ,"第一季度","-","-","第二季度","-","-","第三季度","-","-","第四季度","-","-"}
{"|" ,"|" ,"01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月"}
}
width = {100,100,30,30,30,30,30,30,30,30,30,30,30,30};
height = {60,40,30};
align = 1;
font = {{null,null,::LOGFONT(name="黑体";h=22;color=0x0000FF)},{[0]=::LOGFONT(name="宋体";h=16;color=0xFFFFFF)},{[0]=::LOGFONT(name="宋体";h=12;color=0x800080)}};
bkcolor = {{[1]=0xEEEEEE},{[0]=0xFF901E},{null,null, 0x90EE90,0x90EE90,0x90EE90,
0xEEEEAF,0xEEEEAF,0xEEEEAF,
0xCDFAFF,0xCDFAFF,0xCDFAFF,
0xCBC0FF,0xCBC0FF,0xCBC0FF
}};
);
mainForm.vlist.setColColor(1,0x0000FF/*文本颜色*/,0xEEEEEE/*背景颜色*/);;
//每三行合并单元格
for(i=1;mainForm.vlist.count;3){
mainForm.vlist.addMerge(i /*开始行*/,1/*开始列*/,i+2/*结束行*/,1/*结束列*/)
}
mainForm.vlist.onDrawCellRect = function(row,col,hdc,rect,bkcolor,text,font,align,valign){
//把第一列字体加大
if col===1 {
font.h = 14;
}
//把极好的和极差的,用单元格背景颜色高亮显示
if col>2 {
if (tonumber(text))>=90 {
return false,0x98FB98
} elseif (tonumber(text))<10 {
return false,0xCBC0FF
}
}
}
mainForm.show();
win.loopMessage();