parent
9755b27f72
commit
08ec074bad
|
|
@ -2593,8 +2593,28 @@ type TDgridctl = class(TDComponent)
|
||||||
cvs.drawtext(format('%d,%d',i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
|
cvs.drawtext(format('%d,%d',i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
|
||||||
inherited;
|
inherited;
|
||||||
");
|
");
|
||||||
|
ev := array(
|
||||||
|
"event":"onhitcellsizer",
|
||||||
|
"name":"hitsizer",
|
||||||
|
"param":array("o","e"),
|
||||||
|
"virtual":true,
|
||||||
|
"body":
|
||||||
|
" {**
|
||||||
|
@explan(说明) 命中单元格调整大小边框 %%
|
||||||
|
@param(o)(tgridctl) grid对象 %%
|
||||||
|
@param(e)(tuieventbase) 消息对象包括,等wparam=1 表示行=2 表示列,lparam为命中的行或者列序号 %%
|
||||||
|
**}
|
||||||
|
//绘制表头
|
||||||
|
//if e.wparam=1 then echo '\\r\\nrow:',e.lparam;
|
||||||
|
//if e.wparam=2 then echo '\\r\\ncol:',e.lparam;
|
||||||
|
if e.lparam<o.FixedRows or e.lparam<o.FixedColumns then //行列标不能调整宽度高度
|
||||||
|
begin
|
||||||
|
e.skip := true;//忽略调整宽度
|
||||||
|
end
|
||||||
|
inherited;"
|
||||||
|
);
|
||||||
|
SetDefalutEvent(ev,true);
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
type TDedit= class(TDComponent)
|
type TDedit= class(TDComponent)
|
||||||
function HitTip();override;
|
function HitTip();override;
|
||||||
|
|
|
||||||
|
|
@ -3387,7 +3387,7 @@ type TGridCtl = class(TcustomGridCtl)
|
||||||
"autoscroll","columncount","itemcount",
|
"autoscroll","columncount","itemcount",
|
||||||
"itemheight","mousesizecell","fixedrows","fixedcolumns",
|
"itemheight","mousesizecell","fixedrows","fixedcolumns",
|
||||||
"columnheader","columns",
|
"columnheader","columns",
|
||||||
"ondrawcell","onmousewheel","onmousemove",
|
"ondrawcell","onhitcellsizer","onmousewheel","onmousemove",
|
||||||
"onmousedown","onmouseup","ondblclick",
|
"onmousedown","onmouseup","ondblclick",
|
||||||
"onkeyup","onkeydown","onkeypress","onnotification");
|
"onkeyup","onkeydown","onkeypress","onnotification");
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -578,6 +578,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
end
|
end
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
|
|
||||||
function WMLButtonUp(o,e);override;
|
function WMLButtonUp(o,e);override;
|
||||||
begin
|
begin
|
||||||
fmouseleftdown := false;
|
fmouseleftdown := false;
|
||||||
|
|
@ -657,6 +658,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
if abs(x-bx-v)<3 then
|
if abs(x-bx-v)<3 then
|
||||||
begin
|
begin
|
||||||
if isinmergedcolmn(i,y+5) then break;
|
if isinmergedcolmn(i,y+5) then break;
|
||||||
|
if callondragcellsize(i,2) then break;
|
||||||
FCurrentSizeId := i;
|
FCurrentSizeId := i;
|
||||||
FCurrentSizePos := x;
|
FCurrentSizePos := x;
|
||||||
FCursorRect := array(clientToScreen(max(bx+6,rc[0]+6),y-10),clientToScreen(rc[2],y+10));
|
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
|
if abs(y-bx-v)<3 then
|
||||||
begin
|
begin
|
||||||
if isinmergedrow(i,x+5) then break;
|
if isinmergedrow(i,x+5) then break;
|
||||||
|
if callondragcellsize(i,1) then break;
|
||||||
FCurrentSizeId := i;
|
FCurrentSizeId := i;
|
||||||
FCurrentSizePos := y;
|
FCurrentSizePos := y;
|
||||||
FCursorRect := array(clientToScreen(x-10,max(rc[1]+6,bx+6)),clientToScreen(x+10,rc[3]));
|
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;
|
function Recycling();override;
|
||||||
begin
|
begin
|
||||||
Fondrawcell := nil;
|
Fondrawcell := nil;
|
||||||
|
fonhitcellsizer := nil;
|
||||||
FMergers := array();
|
FMergers := array();
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
|
|
@ -742,6 +746,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
property ColumnCount:integer read GetColumnCount write setcolumncount;
|
property ColumnCount:integer read GetColumnCount write setcolumncount;
|
||||||
property VariableRows read FVariableRows write SetVariableRows;
|
property VariableRows read FVariableRows write SetVariableRows;
|
||||||
property ondrawcell:eventhandler read Fondrawcell write Fondrawcell;
|
property ondrawcell:eventhandler read Fondrawcell write Fondrawcell;
|
||||||
|
property onhitcellsizer:eventhandler read fonhitcellsizer write fonhitcellsizer;
|
||||||
{**
|
{**
|
||||||
@param(ItemCount)(integer) 行数 %%
|
@param(ItemCount)(integer) 行数 %%
|
||||||
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
||||||
|
|
@ -750,7 +755,16 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
protected
|
protected
|
||||||
property cellsizerstate read fcellsizerstate;//调整大小
|
property cellsizerstate read fcellsizerstate;//调整大小
|
||||||
private
|
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
|
begin
|
||||||
for idx,v in FMergers do
|
for idx,v in FMergers do
|
||||||
begin
|
begin
|
||||||
|
|
@ -1042,6 +1056,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
fselbkcolor;
|
fselbkcolor;
|
||||||
//
|
//
|
||||||
Fondrawcell;
|
Fondrawcell;
|
||||||
|
fonhitcellsizer;
|
||||||
fmouseleftdown;
|
fmouseleftdown;
|
||||||
fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽
|
fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽
|
||||||
FScroolChanged;
|
FScroolChanged;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue