aardio高仿某浏览器下载软件界面

By admin at 2020-03-28 • 1人收藏 • 523人看过

这个作为aardio界面练习的第一弹吧

之前发过listbox自绘初始版, 最近稍微修改了下, 自绘适应性更好了点, 后面会把这个listbox这个自绘封装成为一个独立的调用库.

image.png

GIF.gif

自绘源码如下: 未用到其他任何界面库

//GDI自绘
import win.ui;
import fonts.fontAwesome;
/*DSG{{*/
var winform = win.form(text="listbox自绘(GDI方式)";right=778;bottom=472;border="none")
winform.add(
bk={cls="bk";text="  下载 - 云加速由迅雷提供";left=0;top=0;right=779;bottom=33;align="left";bgcolor=16185078;color=5921370;dl=1;dr=1;dt=1;font=LOGFONT(h=-16;name='微软雅黑');forecolor=12632256;linearGradient=0;z=2};
listbox={cls="listbox";left=0;top=32;right=779;bottom=432;bgcolor=16777215;clipch=1;db=1;dl=1;dr=1;dt=1;items={};msel=1;ownerDraw=1;z=1};
plus={cls="plus";text="清空已下载";left=488;top=440;right=599;bottom=468;border={color=-6250332;width=1};color=7895160;db=1;dr=1;font=LOGFONT(h=-17;name='微软雅黑');z=3};
plus2={cls="plus";text="新建";left=605;top=440;right=683;bottom=468;align="right";border={color=-6250332;width=1};color=7895160;db=1;dr=1;font=LOGFONT(h=-17;name='微软雅黑');iconColor=32768;iconStyle={align="left";font=LOGFONT(h=-17;name='FontAwesome');padding={left=13}};iconText='\uF067';textPadding={right=9};z=4};
plus3={cls="plus";text="设置";left=689;top=440;right=767;bottom=468;align="right";border={color=-6250332;width=1};color=7895160;db=1;dr=1;font=LOGFONT(h=-17;name='微软雅黑');iconColor=32768;iconStyle={align="left";font=LOGFONT(h=-17;name='FontAwesome');padding={left=13}};iconText='\uF013';textPadding={right=9};z=5}
)
/*}}*/

//添加无边框标题栏
import win.ui.simpleWindow;
win.ui.simpleWindow(winform,,,,,3);

//先设置行高(自绘用)
winform.listbox.onMeasureItem = function(measureItem){
    measureItem.itemHeight = 51;  
} 

//图标
import win.imageList;
import process;
 
var listboxsel = null;
var beforesel = null;
var colorsel = false;
var opensel = false;
var filesel = false;
 
import fsys;
import fsys.info;
import fsys.file;
import fsys.dlg;
var filename;
var boxTab = {};
//以下均是增加一些本地文件到列表 
var dirPath;
if( !io.exist(dirPath) ) {
    dirPath = fsys.dlg.opendir()
}
if(!dirPath){
    dirPath = "D:\";
}
var files,,dirs = ..fsys.list(dirPath);
for(i=1;#files)
{
        filename = files[ i ];
        var sfi = fsys.info.get(files[filename],0x10/*_SHGFI_USEFILEATTRIBUTES*/ | 0x4000/*_SHGFI_SYSICONINDEX*/ );
        var file = fsys.file(files[filename],"r");
        var fileSize = tonumber(file.size64());
        file.close();//不关掉后面删除就会出错
        if(fileSize/1024 >= 1){
            if(fileSize/1024/1024 >= 1){
                sizes = tostring(math.round(fileSize/1024/1024,2))++" MB";
            }else {
                sizes = tostring(math.round(fileSize/1024,2))++" KB";
            }
                 
        }else {
            sizes = tostring(fileSize)++" B";
        }
         
        table.mixin(boxTab,{ iImage = sfi.iIcon; text = filename; size = sizes ; filePath = files[filename] });
        winform.listbox.add(table.tostring(boxTab))
}
 

//在行间开始自绘 
winform.listbox.onDrawItem = function(drawItem){
     gdi.selectBrush(
        function(hdc,pen,brush){
            //获取并分解需要显示的数据(字符串转表)
            var strTab = eval(winform.listbox.getItemText(drawItem.itemID + 1))
            var rc = drawItem.rcItem;
                    gdi.fillRect(hdc,0xFFFFFF,rc);
                    if (drawItem.itemID > 0) {  
                            gdi.drawLine(hdc,rc.left, rc.top,rc.right, rc.top);
                    }                 
                    if (drawItem.itemState & 1/*_ODS_SELECTED*/) {  
                            gdi.fillRect(hdc,0xFFF5E2,rc); 
                    }else {
                            if(listboxsel == (drawItem.itemID+1)){
                            	gdi.fillRect(hdc,0xEEB7FF,rc);
                            }             
                    }
                             
                    //删除文件
                    if(colorsel){
                        var x,y = win.getMessagePos();  
                        var item = winform.listbox.hitTest(x,y,true);
 
                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=700;color=0x6112FF;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=700;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                        }
                    }else {
                            font = ::LOGFONT(weight=700;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                    }
                     
                    if(opensel){
                        var x,y = win.getMessagePos();  
                        var item = winform.listbox.hitTest(x,y,true);
 
                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=500;color=0x6112FF;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                        }
                             
                    }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                    }
                     
                    if(filesel){
                        var x,y = win.getMessagePos();  
                        var item = winform.listbox.hitTest(x,y,true);
 
                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=500;color=0x6112FF;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20); 
                        }
                     
                    }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20); 
                    }
 
                    //文件图标
                    win.imageList.shell( 0/*_SHIL_LARGE*/ ).draw(strTab.iImage,hdc,rc.left+20,rc.top+10);
                    //文件名
                    font = ::LOGFONT(weight=400;color=0x000000);
                    gdi.textOut(hdc,font,strTab.text,rc.left+60, rc.top+10);
                    //文件大小
                    font = ::LOGFONT(weight=300;color=0xB0B0B0); 
                    gdi.textOut(hdc,font,strTab.size,rc.left+60, rc.top+30); 
                     
                   },drawItem.hDC,0xF5FDFF/*背景色*/,0xEEEEEE/*画笔色*/)
}
  
winform.listbox.wndproc = function(hwnd,message,wParam,lParam){
    select(message) {
        case 0x200/*_WM_MOUSEMOVE*/ {
            var x,y = win.getMessagePos();  
            var item = winform.listbox.hitTest(x,y,true);
            if(item == null){
                return ; 
            }
              
            if(listboxsel == item){   /* 若鼠标在同一行item内游动 */
                    x,y = win.toClient(winform.listbox.hwnd,x,y);
                    for(i=1;3;1){
                            select(i) {
                                    case 1 {        //open
                                            var rc = winform.listbox.getItemRect(item);
                                            rc.left = rc.right-105;
                                            rc.right = rc.left+60;
                                            rc.top = rc.top+10;
                                            rc.bottom = rc.bottom-10 ;
                                            //判断鼠标游动的区间是不是在[删除]按钮范围
                                            if( ::PtInRect(rc,x,y) ){
                                                if(opensel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    opensel = true;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break ; 
                                                }
                                                continue ; //一直在内部区域游动,则不更新
                                            }else {
                                                if(opensel == true){ //鼠标从内到外
                                                    opensel = false;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break ; 
                                                }
                                                continue ; //一直在外部区域游动,则不更新
                                            }
                                                                     
                                             
                                    }
                                    case 2 {        //file
                                            var filerc = winform.listbox.getItemRect(item);
                                            filerc.left = filerc.right-205;
                                            filerc.right = filerc.left+70;
                                            filerc.top = filerc.top+10;
                                            filerc.bottom = filerc.bottom-10 ;
                                            //判断鼠标游动的区间是不是在[删除]按钮范围
                                            if( ::PtInRect(filerc,x,y) ){
                                                if(filesel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    filesel = true;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break; 
                                                }
                                                continue ; //一直在内部区域游动,则不更新
                                            }else {
                                                if(filesel == true){ //鼠标从内到外
                                                    filesel = false;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break ; 
                                                }
                                                continue ; //一直在外部区域游动,则不更新
                                            }
                                             
                                    }
                                    case 3 {        //del
                                            var delrc = winform.listbox.getItemRect(item);
                                            delrc.left = delrc.right-30;
                                            delrc.top = delrc.top+20;
                                            delrc.bottom = delrc.bottom-20 ;
                                            //判断鼠标游动的区间是不是在[删除]按钮范围
                                            if( ::PtInRect(delrc,x,y) ){
                                                if(colorsel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    colorsel = true;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break; 
                                                }
                                                continue ; //一直在内部区域游动,则不更新
                                            }else {
                                                if(colorsel == true){ //鼠标从内到外
                                                    colorsel = false;
                                                    //设置更新区,并更新
                                                    winform.listbox.invalidate(winform.listbox.getItemRect(item))
                                                    winform.listbox.update();
                                                    break ; 
                                                }
                                                continue ; //一直在外部区域游动,则不更新
                                            }
                                    }
                            }
                    } 
                return ; 
                        }else {
                                //设置hover效果
                                listboxsel = item;
                                if(beforesel == null){        //第一次执行,初始化
                                        beforesel = listboxsel;
                                         
                                }else {
                                        //先关闭上次绘制区域
                                        if(beforesel){
                                                winform.listbox.invalidate(winform.listbox.getItemRect(beforesel),0)        
                                        }
                                        beforesel = listboxsel;
                                }
                                //绘制当前区域
                                winform.listbox.invalidate(winform.listbox.getItemRect(item));
                                winform.listbox.update();
                        }
            }
            case 0x202/*_WM_LBUTTONUP*/ {
                    //删除功能
                    if(colorsel){        /* 若鼠标在删除按钮区域内单击了 */
                                var selindex = winform.listbox.selIndex
                                var strTab = winform.listbox.getItemText(selindex);
                                var tabStr = eval(strTab)
                                var ret = winform.msgboxTest("您确定要删除 ["++tabStr.text++"] 文件吗?");
                                if(ret){
                                        winform.listbox.delete(selindex);
                                        colorsel = false;
                                }
                                return ; 
                        };
                        //打开文件
                        if(opensel){        /* 若鼠标在打开按钮区域内单击了 */
                                var selindex = winform.listbox.selIndex
                                var strTab = winform.listbox.getItemText(selindex);
                                var tabStr = eval(strTab)
                                process.execute(tabStr.filePath);
                                return ; 
                        }
                        //打开文件夹
                        if(filesel){        /* 若鼠标在打开按钮区域内单击了 */
                                var selindex = winform.listbox.selIndex
                                var strTab = winform.listbox.getItemText(selindex);
                                var tabStr = eval(strTab)
                                var path = io.splitpath(tabStr.filePath);
                                process.execute(path.dir);
                                return ; 
                        }
            }
            case 0x20A/*_WM_MOUSEWHEEL*/{
            	var wheelDelta = raw.convert({int wParam=wParam },{word vk;word delta}).delta;
        		if( wheelDelta > 0 ){
            		::SendMessageInt(winform.listbox.hwnd, 0x115/*_WM_VSCROLL*/, 0, 0);
        		}else {
            		::SendMessageInt(winform.listbox.hwnd, 0x115/*_WM_VSCROLL*/, 1, 0); 
        		}
        		return 0;
            };
            else { 
            }
    }
}


//底部按钮皮肤 
var bskin={
	background={
		default=0xFFF8F8F8;
		hover=0xFFD1D1D1
	};
}
 
winform.plus.skin(bskin)
winform.plus2.skin(bskin) 
winform.plus3.skin(bskin) 
 
winform.show();
win.loopMessage();


1 个回复 | 最后更新于 2020-03-28
2020-03-28   #1

针对上面的应用封装了个库

listboxEx.aardio

//listbox自绘
import win.imageList;
import gdi;
import fonts.fontAwesome;
class listboxEx{
	ctor( winform,Iheight=51,backColor=0xFFFFFF,activedColor=0xFFF5E2,hoverColor=0xEEB7FF ){
		//先设置行高(自绘用)
		winform.onMeasureItem = function(measureItem){
    		measureItem.itemHeight = Iheight;  
		};
		//在行间开始自绘 
		winform.onDrawItem = function(drawItem){
     		..gdi.selectBrush(
        		function(hdc,pen,brush){
            		//获取并分解需要显示的数据(字符串转表)
            		var str = winform.getItemText(drawItem.itemID + 1);
            		if(!str){
            			return;
            		}
            		var strTab = eval(str)
            		var rc = drawItem.rcItem;
                    ..gdi.fillRect(hdc,backColor,rc);
                    if (drawItem.itemID > 0) {  
                            ..gdi.drawLine(hdc,rc.left, rc.top,rc.right, rc.top);
                    }                 
                    if (drawItem.itemState & 1/*_ODS_SELECTED*/) {  
                            ..gdi.fillRect(hdc,activedColor,rc); 
                    }else {
                            if(listboxsel == (drawItem.itemID+1)){
                            	..gdi.fillRect(hdc,hoverColor,rc);
                            }             
                    }
                             		
                    //删除文件
                    if(colorsel){
                        var x,y = ..win.getMessagePos();  
                        var item = winform.hitTest(x,y,true);

                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=700;color=0x6112FF;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=700;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                        }
                    }else {
                            font = ::LOGFONT(weight=700;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF057',/*rc.width()/2+345*/rc.right-30, rc.top+20);
                    }
                     		
                    if(opensel){
                        var x,y = ..win.getMessagePos();  
                        var item = winform.hitTest(x,y,true);

                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=500;color=0x6112FF;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                        }
                            
                    }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF0F6 打开',/*rc.width()/2+190*/rc.right-105, rc.top+20);
                    }
                     		
                    if(filesel){
                        var x,y = ..win.getMessagePos();  
                        var item = winform.hitTest(x,y,true);

                        if((drawItem.itemID+1) == item){
                            font = ::LOGFONT(weight=500;color=0x6112FF;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20);
                        }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20); 
                        }
                    
                    }else {
                            font = ::LOGFONT(weight=300;color=0x9C9C9C;name='FontAwesome';h=-16); 
                            ..gdi.textOut(hdc,font,'\uF115 文件夹',/*rc.width()/2+260*/rc.right-205, rc.top+20); 
                    }
 		
                    //文件图标
                    ..win.imageList.shell( 0/*_SHIL_LARGE*/ ).draw(strTab.iImage,hdc,rc.left+20,rc.top+10);
                    //文件名
                    font = ::LOGFONT(weight=400;color=0x000000);
                    ..gdi.textOut(hdc,font,strTab.text,rc.left+60, rc.top+10);
                    //文件大小
                    font = ::LOGFONT(weight=300;color=0xB0B0B0); 
                    ..gdi.textOut(hdc,font,strTab.size,rc.left+60, rc.top+30); 
                    
        	},drawItem.hDC,0xF5FDFF/*背景色*/,0xEEEEEE/*画笔色*/)
		};
		winform.wndproc = function(hwnd,message,wParam,lParam){
    		select(message) {
        		case 0x200/*_WM_MOUSEMOVE*/ {
            		var x,y = ..win.getMessagePos();  
            		var item = winform.hitTest(x,y,true);
            		if(item == null){
                		return ; 
            		}
              		
            		if(listboxsel == item){   /* 若鼠标在同一行item内游动 */
                    		x,y = ..win.toClient(winform.hwnd,x,y);
                    		for(i=1;3;1){
                            		select(i) {
                                    		case 1 {        //open
                                            		var rc = winform.getItemRect(item);
                                            		rc.left = rc.right-105;
                                            		rc.right = rc.left+60;
                                            		rc.top = rc.top+10;
                                            		rc.bottom = rc.bottom-10 ;
                                            		//判断鼠标游动的区间是不是在[删除]按钮范围
                                            		if( ::PtInRect(rc,x,y) ){
                                                		if(opensel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    		opensel = true;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break ; 
                                                		}
                                                		continue ; //一直在内部区域游动,则不更新
                                            		}else {
                                                		if(opensel == true){ //鼠标从内到外
                                                    		opensel = false;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break ; 
                                                		}
                                                		continue ; //一直在外部区域游动,则不更新
                                            		}
                                                                     		
                                             		
                                    		}
                                    		case 2 {        //file
                                            		var filerc = winform.getItemRect(item);
                                            		filerc.left = filerc.right-205;
                                            		filerc.right = filerc.left+70;
                                            		filerc.top = filerc.top+10;
                                            		filerc.bottom = filerc.bottom-10 ;
                                            		//判断鼠标游动的区间是不是在[删除]按钮范围
                                            		if( ::PtInRect(filerc,x,y) ){
                                                		if(filesel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    		filesel = true;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break; 
                                                		}
                                                		continue ; //一直在内部区域游动,则不更新
                                            		}else {
                                                		if(filesel == true){ //鼠标从内到外
                                                    		filesel = false;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break ; 
                                                		}
                                                		continue ; //一直在外部区域游动,则不更新
                                            		}
                                             		
                                    		}
                                    		case 3 {        //del
                                            		var delrc = winform.getItemRect(item);
                                            		delrc.left = delrc.right-30;
                                            		delrc.top = delrc.top+20;
                                            		delrc.bottom = delrc.bottom-20 ;
                                            		//判断鼠标游动的区间是不是在[删除]按钮范围
                                            		if( ::PtInRect(delrc,x,y) ){
                                                		if(colorsel == false){    //鼠标从[删除]按钮外部移动到内部区域
                                                    		colorsel = true;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break; 
                                                		}
                                                		continue ; //一直在内部区域游动,则不更新
                                            		}else {
                                                		if(colorsel == true){ //鼠标从内到外
                                                    		colorsel = false;
                                                    		//设置更新区,并更新
                                                    		winform.invalidate(winform.getItemRect(item))
                                                    		winform.update();
                                                    		break ; 
                                                		}
                                                		continue ; //一直在外部区域游动,则不更新
                                            		}
                                    		}
                            		}
                    		} 
                		return ; 
                        		}else {
                                		//设置hover效果
                                		listboxsel = item;
                                		if(beforesel == null){        //第一次执行,初始化
                                        		beforesel = listboxsel;
                                         		
                                		}else {
                                        		//先关闭上次绘制区域
                                        		if(beforesel){
                                                		winform.invalidate(winform.getItemRect(beforesel),0)        
                                        		}
                                        		beforesel = listboxsel;
                                		}
                                		//绘制当前区域
                                		winform.invalidate(winform.getItemRect(item));
                                		winform.update();
                        		}
            		}
            		case 0x202/*_WM_LBUTTONUP*/ {
                    		//删除功能
                    		if(colorsel){        /* 若鼠标在删除按钮区域内单击了 */
                                if(this.colorsel){
									this.colorsel(winform.selIndex);
									}
                                return ; 
                        	};
                        	//打开文件
                        	if(opensel){        /* 若鼠标在打开按钮区域内单击了 */
                                if(this.opensel){
									this.opensel(winform.selIndex);
								}
								return;
                        	}
                        	//打开文件夹
                        	if(filesel){        /* 若鼠标在打开按钮区域内单击了 */
								if(this.filesel){
									this.filesel(winform.selIndex);
								}
								return;
                        	}
            		}
            		case 0x20A/*_WM_MOUSEWHEEL*/{	//滚轮消息
            			var wheelDelta = ..raw.convert({int wParam=wParam },{word vk;word delta}).delta;
        				if( wheelDelta > 0 ){
            				::SendMessageInt(winform.hwnd, 0x115/*_WM_VSCROLL*/, 0, 0);
        				}else {
            				::SendMessageInt(winform.hwnd, 0x115/*_WM_VSCROLL*/, 1, 0); 
        				}
        				return 0;
            		};
            		else { 
            		}
    		}
		}
		return this;
	};
}

namespace listboxEx{

	
}

使用的话:

mainform.aardio

import win.ui;
/*DSG{{*/
mainForm = win.form(text="aardio工程17";right=715;bottom=466)
mainForm.add(
button={cls="button";text="增加一行示例";left=570;top=422;right=708;bottom=461;db=1;dr=1;z=2};
listbox={cls="listbox";left=0;top=0;right=716;bottom=416;db=1;dl=1;dr=1;dt=1;edge=1;items={};ownerDraw=1;z=1}
)
/*}}*/

import console
console.open()
import listboxEx;

var libox = listboxEx(mainForm.listbox,51,0xF5F0EB,0xFFE9D4,0xFFFAF5);
libox.filesel = function(index){
	console.log("filesel",index)
}
libox.opensel = function(index){
	console.log("opensel",index)
}
libox.colorsel = function(index){
	console.log("colorsel",index)
}

var i=1
mainForm.button.oncommand = function(id,event){
	var sstab = {};
    table.mixin(sstab,{ iImage = math.random(0,2); text = "增加示例行"++i; size = "7.7 MB" });
    mainForm.listbox.add(table.tostring(sstab))
    i++;
}

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

进一步的封装, 只能有灵感的时候了...

登录后方可回帖

登 录
信息栏
本站永久域名:HtmLayout.Cn
纯私人站,当笔记本用的,学到哪写到哪,目前正在学aardio+halcon机器视觉.
Sciter中文在线文档Sciter在线学习文档
本 站 主 站:Stm32cube中文网
Aardio 官方站:Aardio官方
Aardio最新功能:Aardio官方更新日志
aardio在线手册Aardio在线手册
C大Aardio论坛:Aar爱好者论坛
简码教程网:简码编程
AARDIO语言QQ群:70517368
赞助商:才仁机械
下载站:非凡软件站
Loading...