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);
|
||||
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
|
||||
type TDedit= class(TDComponent)
|
||||
function HitTip();override;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -578,6 +578,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
|||
end
|
||||
inherited;
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue