虚表 —— 保存为图片

import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=1055;bottom=687;border="thin")
mainForm.add(
plus={cls="plus";left=336;top=24;right=1048;bottom=680;bgcolor=16777215;z=2};
vlist={cls="vlistEx";left=16;top=24;right=328;bottom=248;edge=1;z=1}
)
/*}}*/

mainForm.vlist.setRowHeight(80);
var t = {};
for(i=1;100;1){
    var color = gdi.ARGB(math.random(1,255),math.random(1,255),math.random(1,255),255);
    var colortext = ..string.format("0x%X", color);
    ..table.push(t,{"[@rowindex]",
                "<img name='@ownerDrawImg',w=30,h=30,scale=true,param={1,"++colortext++"}> "++colortext,
                "<img name='@ownerDrawImg',full=true,param={2,"++colortext++"}>这里是铺满的图片",
                "<img name='@ownerDrawImg',x=0,y=0,w=20,h=20,param={1,"++colortext++"}><img name='@ownerDrawImg',x=-20,y=0,w=20,h=20,param={2,"++colortext++"}><img name='@ownerDrawImg',x=0,y=-20,w=20,h=20,param={2,"++colortext++"}><img name='@ownerDrawImg',x=-20,y=-20,w=20,h=20,param={1,"++colortext++"}>图片定点放置",
                })
}
mainForm.vlist.setTable(t,{"编号","<img name='@ownerDrawImg',w=30,h=30,scale=true,param={2,0xFF00FFFF}> 混合排版","填满单元格","定点绘制"}/*列标题*/,{50,260,160,160}/*列宽*/,1/*对齐方式*/,/*字典转为数组*/,/*字符串转为Utf8*/,/*是否克隆新表*/)
mainForm.vlist.ownerDrawImg = function (row,col,hdc,x,y,w,h,param){
    /*图片自绘。当img的name='@ownerDrawImg'时,调用该函数处理图片。
      img定义时,需提供param参数给本函数调用,如 <img name='@ownerDrawImg',param={0xFF000000}*/
    var gra=..gdip.graphics(hdc);
    var brush = ..gdip.solidBrush(param[2]);
    if param[1]==1 gra.fillRectangle(brush,x,y,w,h);
    else gra.fillEllipse(brush,x,y,w,h);
    brush.delete();
    gra.delete();
}
mainForm.show();
mainForm.plus.foreground = mainForm.vlist.saveToImg();
win.loopMessage();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卢光庆

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值