|
本帖最后由 iaauto 于 2018-8-6 15:52 编辑
试着修改了listview重绘的例子,现在效果不是很好
问题1:第一次运行第一项没有勾选,但是显示成了红色
问题2:勾选后有时会变成红色,有时不会变成红色
- import win.ui;
- /*DSG{{*/
- var winform = win.form(text="aardio form";right=759;bottom=469)
- winform.add(
- button={cls="button";text="button";left=283;top=319;right=426;bottom=399;z=1};
- checklist={cls="checklist";left=215;top=91;right=532;bottom=259;edge=1;items={};z=2}
- )
- /*}}*/
- winform.checklist.items = { "测试项目";"测试项目2";"测试项目3" }
- winform.checklist.onnotify = function(id,code,ptr){
- if( code == 0xFFFFFFF4/*_NM_CUSTOMDRAW*/ ){
- var lvcd = winform.checklist.getNotifyCustomDraw(code,ptr);
- if( lvcd.nmcd.dwDrawStage == 0x10001/*_CDDS_ITEMPREPAINT*/)
- return 0x20/*_CDRF_NOTIFYSUBITEMDRAW*/
- elseif( lvcd.nmcd.dwDrawStage == 1/*_CDDS_PREPAINT*/ ){
- return 0x20/*_CDRF_NOTIFYITEMDRAW*/;
- }
- elseif( lvcd.nmcd.dwDrawStage == ( 0x10001/*_CDDS_ITEMPREPAINT*/ | 0x20000/*_CDDS_SUBITEM*/) ){
- lvcd.clrText = winform.checklist.getChecked(lvcd.nmcd.dwItemSpec) ? gdi.RGB(255,0,0) : gdi.RGB(0,0,0);
- lvcd.update()
- return 0/*_CDRF_DODEFAULT*/
- }
- }
- }
- winform.show()
- win.loopMessage();
复制代码 |
|