虚表 —— 改变checkbox颜色值

光庆 23天前 261

1、使用图片示例:

import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=343;bottom=263;border="thin")
mainForm.add(
listview={cls="vlistEx";left=16;top=24;right=328;bottom=248;edge=1;z=1}
)
/*}}*/
mainForm.listview.setColumns("选择框")
var t = { {"火影"}, {"鸣人"}, {"我爱罗"}, {"玉凤"}, {"哈哈哈"}}
mainForm.listview.setTable(t,false);
mainForm.listview.checkBox.show = true;
mainForm.listview.checkBox.checkedImg = true; //使用默认图片
mainForm.listview.checkBox.uncheckedImg = true; //使用默认图片
mainForm.listview.checkBox.setColor(0xFFFF0000 /*正常状态颜色值*/,0xFF00AA00 /*选中状态颜色值*/);
mainForm.show();
win.loopMessage();

2、使用颜色自绘示例:

import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=343;bottom=263;border="thin")
mainForm.add(
listview={cls="vlistEx";left=16;top=24;right=328;bottom=248;edge=1;z=1}
)
/*}}*/
//======================= 创建虚表 =======================
mainForm.listview.setColumns("选择框")
var t = { {"火影"}, {"鸣人"}, {"我爱罗"}, {"玉凤"}, {"哈哈哈"}}
mainForm.listview.setTable(t,false);
mainForm.listview.checkBox.show = true;
mainForm.listview.checkBox.size=30;
mainForm.listview.setRowHeight(50);
mainForm.listview.checkBox.setColor( /*正常状态颜色值*/,0xFF00AA00 /*选中状态颜色值*/);
mainForm.show();
win.loopMessage();

3、其他效果

import win.ui;
import godking.vlistEx;
/*DSG{{*/
mainForm = win.form(text="vlistEx - table adapter";right=671;bottom=263;border="thin")
mainForm.add(
listview={cls="vlistEx";left=16;top=24;right=328;bottom=248;edge=1;z=1};
vlistEx={cls="vlistEx";left=344;top=24;right=656;bottom=248;edge=1;z=2}
)
/*}}*/

var t = { {"火影"}, {"鸣人"}, {"我爱罗"}, {"玉凤"}, {"哈哈哈"}}

mainForm.listview.setColumns("选择框")
mainForm.listview.setTable(t,false/*列标题*/,/*列宽*/,/*0左1中2右*/,/*字典转为数组*/,/*字符串转为Utf8*/,true/*是否克隆新表*/)
mainForm.listview.checkBox.show = true;
mainForm.listview.checkBox.setColor(0x00FF0000 /*正常状态颜色值*/,0x00000001 /*选中状态颜色值*/,0xFFFF0000 /*绘制对号颜色值*/)

mainForm.vlistEx.setColumns("选择框")
mainForm.vlistEx.setTable(t,false/*列标题*/,/*列宽*/,/*0左1中2右*/,/*字典转为数组*/,/*字符串转为Utf8*/,true/*是否克隆新表*/)
mainForm.vlistEx.checkBox.show = true;
mainForm.vlistEx.checkBox.setColor(0x00FFFF00 /*正常状态颜色值*/,0xFF00AAAA /*选中状态颜色值*/,0xFFFFFF00 /*绘制对号颜色值*/)

mainForm.show();
win.loopMessage();


最新回复 (2)
  • axuanup 23天前
    0 引用 2
    可以不用图片了吗,大佬
  • 光庆 23天前
    0 引用 3
    axuanup 可以不用图片了吗,大佬

    已升级v10.3,默认不使用图片,而是使用颜色自绘。

返回