1、使用_vlistEx_ColType_Button类型实现:

Code AardioLine:32复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.import
win
.ui;import
godking.vlistEx;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
},,,,); - 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,1,, );
- 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();
2、使用_vlistEx_ColType_Button类型+gdi绘图,给图标添加标题:

Code AardioLine:40复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.import
win
.ui;import
godking.vlistEx;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
},,,,); 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,1,, );
- 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|0x20); - }
-
- }
- 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();
3、使用_vlistEx_ColType_OwnerDrawCustom类型实现图标+标题:

Code AardioLine:66复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.import
win
.ui;import
godking.vlistEx;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
} - )
var
itemModel = {- {
type
="img"
; - name=
"img"
; - rectf={x=
10
,y=0
,width=30
,height=30
}; - hover=
true
; - scale=
true
; - }
- {
type
="text"
; - name=
"text"
; - rectf={x=
0
,y=30
,width=50
,height=20
}; - font={name=
"宋体"
,h=12
,color=0xFF000000}; - itemhoverfont={name=
"宋体"
,h=12
,color=0xFFFF0000}; - hover=
true
; - align=
1
; - valign=
1
; - }
- }
- winform.menu.setTable({{
"\1 - 副本.png|\1.png|打开"
, -
"\2 - 副本.png|\2.png|编辑"
, -
"\3 - 副本.png|\3.png|视图"
, -
"\4 - 副本.png|\4.png|阅览"
, -
"\0.png"
, -
"\5 - 副本.png|\5.png|打印"
, -
"\6 - 副本.png|\6.png|帮助"
, -
"\0.png"
, -
"\7 - 副本.png|\7.png|关于"
, - }} ,,{
50
,50
,50
,50
,30
,50
,50
,30
,50
},,,,); - winform.menu.setColumnType({
1
,2
,3
,4
,6
,7
,9
},7,itemModel ); - winform.menu.setColumnType({
5
,8
},2,1,5 ); - winform.menu.hideScroll(true,true);
- winform.menu.setHeaderHeight(
0
); - winform.menu.setRowHeight(
50
); - winform.menu.lineWidthV =
null
; - winform.menu.selectedBkColor =
null
; - winform.menu.padding =
0
; - winform.menu.ownerDrawCustom =
function
(row,col,text){ -
-
var
s=..string
.split(text,"|"
); -
return
{ img={ - img = s[
1
]; - itemhoverimg = s[
2
]; - };
- text = s[
3
]; - };
- }
- 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();
代码文件及素材见附件。