界面库

优化表格
This commit is contained in:
JianjunLiu
2022-11-08 10:43:43 +08:00
parent 9755b27f72
commit 08ec074bad
3 changed files with 39 additions and 4 deletions
+1 -1
View File
@@ -3387,7 +3387,7 @@ type TGridCtl = class(TcustomGridCtl)
"autoscroll","columncount","itemcount",
"itemheight","mousesizecell","fixedrows","fixedcolumns",
"columnheader","columns",
"ondrawcell","onmousewheel","onmousemove",
"ondrawcell","onhitcellsizer","onmousewheel","onmousemove",
"onmousedown","onmouseup","ondblclick",
"onkeyup","onkeydown","onkeypress","onnotification");
end
+17 -2
View File
@@ -577,7 +577,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
//fleftdowncell := getindexbypos(x,y);
end
inherited;
end
end
function WMLButtonUp(o,e);override;
begin
fmouseleftdown := false;
@@ -657,6 +658,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
if abs(x-bx-v)<3 then
begin
if isinmergedcolmn(i,y+5) then break;
if callondragcellsize(i,2) then break;
FCurrentSizeId := i;
FCurrentSizePos := x;
FCursorRect := array(clientToScreen(max(bx+6,rc[0]+6),y-10),clientToScreen(rc[2],y+10));
@@ -679,6 +681,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
if abs(y-bx-v)<3 then
begin
if isinmergedrow(i,x+5) then break;
if callondragcellsize(i,1) then break;
FCurrentSizeId := i;
FCurrentSizePos := y;
FCursorRect := array(clientToScreen(x-10,max(rc[1]+6,bx+6)),clientToScreen(x+10,rc[3]));
@@ -730,6 +733,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
function Recycling();override;
begin
Fondrawcell := nil;
fonhitcellsizer := nil;
FMergers := array();
inherited;
end
@@ -742,6 +746,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
property ColumnCount:integer read GetColumnCount write setcolumncount;
property VariableRows read FVariableRows write SetVariableRows;
property ondrawcell:eventhandler read Fondrawcell write Fondrawcell;
property onhitcellsizer:eventhandler read fonhitcellsizer write fonhitcellsizer;
{**
@param(ItemCount)(integer) 行数 %%
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
@@ -750,7 +755,16 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
protected
property cellsizerstate read fcellsizerstate;//调整大小
private
function isinmergedcolmn(i,y);
function callondragcellsize(i,r);
begin
if fonhitcellsizer then
begin
e := new tuieventbase(0,r,i,0);
CallMessgeFunction(fonhitcellsizer,self(true),e);
return e.skip;
end
end
function isinmergedcolmn(i,y);
begin
for idx,v in FMergers do
begin
@@ -1042,6 +1056,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
fselbkcolor;
//
Fondrawcell;
fonhitcellsizer;
fmouseleftdown;
fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽
FScroolChanged;