虚表 —— 模拟横向工具栏

光庆 4天前 261

import win.ui;
import godking.vlistEx;
/*DSG{{*/
var winform = win.form(text="aardio form";right=711;bottom=311;bgcolor=16777215)
winform.add(
menu={cls="vlistEx";left=8;top=8;right=704;bottom=72;bgcolor=16777215;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
winform.menu.setTable({{"\1 - 副本.png|\1.png",
						"\2 - 副本.png|\2.png",
						"\3 - 副本.png|\3.png",
						"\4 - 副本.png|\4.png",
						"\0.png|\0.png",
						"\5 - 副本.png|\5.png",
						"\6 - 副本.png|\6.png",
						"\0.png|\0.png",
						"\7 - 副本.png|\7.png",
}} /*数据表*/,/*列标题*/,{50,50,50,50,30,50,50,30,50}/*列宽*/,/*0左1中2右*/,/*字典转为数组*/,/*字符串转为Utf8*/,/*是否克隆新表*/);
winform.menu.hideScroll(true/*隐藏横向滚动条*/,true/*隐藏纵向滚动条*/);
winform.menu.setHeaderHeight(0);
winform.menu.setRowHeight(50);
winform.menu.lineWidthV = null;
winform.menu.selectedBkColor = null;
winform.menu.padding = {top=10,bottom=10};
winform.menu.setColumnType(/*列号*/,5/*_vlistEx_ColType_Button*/,1/*0居中1缩放2填满*/,/*正常图片*/,/*鼠标悬停图片*/ );
winform.menu.onClick = function(row/*行*/,col/*列*/,x,y,buttonIndex/*按钮序号*/){
	if row and table.find({1,2,3,4,6,7,9},col){
		win.msgbox("您点击了第"++col++"个按钮");
	}
}
winform.show();
win.loopMessage();

带标题:

import win.ui;
import godking.vlistEx;
/*DSG{{*/
var winform = win.form(text="aardio form";right=711;bottom=311;bgcolor=16777215)
winform.add(
menu={cls="vlistEx";left=8;top=8;right=704;bottom=72;bgcolor=16777215;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/

winform.menu.setTable({{"\1 - 副本.png|\1.png",
						"\2 - 副本.png|\2.png",
						"\3 - 副本.png|\3.png",
						"\4 - 副本.png|\4.png",
						"\0.png|\0.png",
						"\5 - 副本.png|\5.png",
						"\6 - 副本.png|\6.png",
						"\0.png|\0.png",
						"\7 - 副本.png|\7.png",
}} /*数据表*/,/*列标题*/,{50,50,50,50,30,50,50,30,50}/*列宽*/,/*0左1中2右*/,/*字典转为数组*/,/*字符串转为Utf8*/,/*是否克隆新表*/);
var title={"打开","编辑","视图","阅览","|","打印","帮助","|","关于"};
winform.menu.hideScroll(true/*隐藏横向滚动条*/,true/*隐藏纵向滚动条*/);
winform.menu.setHeaderHeight(0);
winform.menu.setRowHeight(50);
winform.menu.lineWidthV = null;
winform.menu.selectedBkColor = null;
winform.menu.padding = {top=0,bottom=20};
winform.menu.setColumnType(/*列号*/,5/*_vlistEx_ColType_Button*/,1/*0居中1缩放2填满*/,/*正常图片*/,/*鼠标悬停图片*/ );
winform.menu.onDrawCellEnd = function(row,col,hdc,rect,bkcolor,text,font,colalign){
	if row and table.find({1,2,3,4,6,7,9},col){
		rect.top +=30;
		..gdi.drawTextCenter(hdc,..gdi.getFont(owner.hwnd),title[col],rect,4/*_DT_VCENTER*/|0x20/*_DT_SINGLELINE*/);
	}	
	
}
winform.menu.onClick = function(row/*行*/,col/*列*/,x,y,buttonIndex/*按钮序号*/){
	if row and table.find({1,2,3,4,6,7,9},col){
		win.msgbox("您点击了第"++col++"个按钮");
	}
}
winform.show();
win.loopMessage();




代码文件及素材见附件。

上传的附件:
最新回复 (6)
  • 近我者赤 4天前
    0 引用 2

  • 近我者赤 4天前
    0 引用 3
    能在图标下方加标题不?
  • 光庆 3天前
    0 引用 4
    近我者赤 能在图标下方加标题不?
    已添加例子代码
  • 近我者赤 3天前
    0 引用 5

  • lcj21 2天前
    0 引用 6
    虚表越来越好越来越强大了
  • breezee 2天前
    0 引用 7
    老大威武!虚表被你玩出花来了!
返回