
Code AardioLine:103复制
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.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.96.97.98.99.100.101.102.103.import
win
.ui;import
godking.vlistEx;var
winform = win
.form(text="图标矩阵"
;right=600
;bottom=400
;bgcolor=16777215
)- winform.add(
- grid={cls=
"vlistEx"
;left=10
;top=10
;right=590
;bottom=390
;bgcolor=16777215
;db=1
;dl=1
;dr=1
;dt=1
;z=1
} - )
import
inet.httpimport
godking.paintvar
imgs = godking.paint.splitImage("https://aardio.online/upload/files/20250124/1737707732.png"
,5
,5
,0
,0
,0
,0
);for
(i=1
;- winform.grid.addImg(
"img"
+i,imgs[i],false); - }
var
iconData = {- {
"img1"
, "img3"
}, - {
"img5"
, "img7"
}, - }
var
title = {- {
"图标1-1"
, "图标1-2"
}, - {
"图标2-1"
, "图标2-2"
}, - }
- winform.grid.setTable(iconData,
null
,100
,1
); - winform.grid.hideScroll(true,true,true);
- winform.grid.setHeaderHeight(
0
); - winform.grid.setRowHeight(
100
); - winform.grid.lineWidthV =
null
; - winform.grid.selectedBkColor =
null
; - winform.grid.padding =
10
; - winform.grid.setColumnType(, 6 );
var
list,oldrow,oldcol = {};import
win
.timervar
timer = ..win
.timer(winform);- timer.onTimer =
function
(){ -
thread
.lock("list"
); -
var
rows = {}; -
for
(k,v in
list){ - rows[v[
1
]] = true
; - list[k][
3
]++; -
if
list[k][3
]>5
list[k]=null
; - }
-
for
(k,v in
rows){ - winform.grid.redrawRow(k);
- }
-
if
!..table
.count(list) owner
.disable(); -
thread
.unlock("list"
); - }
- winform.grid.ownerDraw =
function
(row,col,hdc,x,y,w,h,param,...){ -
var
p = godking.paint.fromHdc(hdc); -
var
rect = ::RECT(x,y,x+w,y+h-20
).inflate(-5
,-5
); -
if
list[row*1000
+col] { -
var
pad = 5
-..math
.abs(list[row*1000
+col][3
]); - rect.inflate(pad,pad);
- }
- p.drawImage(rect ,
owner
.getImg(param),,true); -
var
rect = ::RECT(x,y+h-20
,x+w,y+h); - p.drawText(rect ,title[row][col],
owner
.font,0,1,1,false); - p.close();
- }
- winform.grid.onMouseMove =
function
(x,y,row,col){ -
if
oldrow!==row or
oldcol!==col { - oldrow = row;
- oldcol = col;
-
if
row and
col { -
thread
.lock("list"
); - list[row*
1000
+col] = {row,col,-5
}; -
thread
.unlock("list"
); - timer.enable(
10
); - }
- }
- }
- winform.grid.onClick =
function
(row, col, x, y, buttonIndex) { -
if
row and
col { -
win
.msgbox("点击了第"
+ row + "行第"
+ col + "列:"
+ title[row][col]); - }
- }
- winform.show();
win
.loopMessage();