From 8dc7a0c6d8ab646264f4aecc97b4075039895c77 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Sat, 22 Oct 2022 07:12:12 +0800 Subject: [PATCH] Update utslvclgrid.tsf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浼樺寲 --- funcext/tvclib/utslvclgrid.tsf | 100 +++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 37 deletions(-) diff --git a/funcext/tvclib/utslvclgrid.tsf b/funcext/tvclib/utslvclgrid.tsf index 985a9ff..a313ac0 100644 --- a/funcext/tvclib/utslvclgrid.tsf +++ b/funcext/tvclib/utslvclgrid.tsf @@ -41,10 +41,6 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // begin InvalidateRect(nil,false); end - function UpDateScrollBar(); - begin - DoControlAlign(); - end public function IncPaintLock(); begin @@ -66,40 +62,22 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // end inherited; end + function UpDateScrollBar(); + begin + DoControlAlign(); + end function DoControlAlign();override; begin - UpDateFixed(); - InitialScroll(); - end - private - function allwidth(); - begin - //return (FxWidth-FXfiexed); - r := 0; - for i:= 0 to FColsWidths.length()-1 do + if(IsUpDating())then begin - r+=FColsWidths[i]; - end - return r; - end - function allheigth(); - begin - //return FyHeight-FYfiexed; - if FVariableRows then + FScroolChanged := true; + end else begin - r := 0; - for i:= 0 to FRowsHeight.length()-1 do - begin - r+=FRowsHeight[i]; - end - return r; - end else - begin - r := FRowHeight*FItemCount; - return r; - end + UpDateFixed(); + pt := New TPAINTCOUNT(self); + InitialScroll(); + end end - public function Create(AOwner);override; //构造 begin inherited; @@ -127,6 +105,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // FColsWidths := new tnumindexarray(); FRowsHeight := new tnumindexarray(); FVariableRows := false; + ThumbTrack := true; + FScroolChanged := false; end function GetItemRect(i);virtual; //根据行号获得其区域 begin @@ -721,6 +701,14 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // @param(FixedRows)(integer) 固定的行数作为列标 %% **} private + function allwidth(); + begin + return FxWidth; + end + function allheigth(); + begin + return FyHeight; + end function DrawAllParts(cvs,part,merg,rec); begin bcvs := new TCanvsRgnClipAutoSave(cvs,rec); @@ -854,7 +842,6 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // DoControlAlign(); end end - function UpDateFixed(); //更新固定宽度 begin xfix := 0; @@ -879,6 +866,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // end end else begin + FyHeight := FRowHeight*FItemCount; FYfiexed := FMarginTop+FFixedRows * FRowHeight; end FXfiexed := FMarginLeft+xfix; @@ -906,7 +894,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // cursor := FC_NORMAL; FC_CURRENT := FC_NORMAL; end - end + end + FScroolChanged; FMergers; FAutoScroll; //固定*********** @@ -943,6 +932,43 @@ type TcustomGridCtl = class(tcustomscrollcontrol) // FCurrentSizeId; FCurrentSizePos; end + + + +type TCanvsRgnClipAutoSave=class()//canvas 裁剪 + {** + @expan(说明) 裁剪canvas区域,销毁时还原 %% + **} + function Create(cvs,rec); + begin + {** + @explan(说明)构造裁剪对象 %% + @param(cvs)(tcustomcanvas) canvas 对象 %% + @param(rec)(array(左上右下))区域 %% + **} + if(cvs is class(tcustomcanvas))and cvs.HandleAllocated()and ifarray(rec)then + begin + FW32api := cvs._wapi; + FCvsHandle := cvs.Handle; + FCrg := FW32api.CreateRectRgn(rec[0],rec[1],rec[2],rec[3]); + FBKrg := FW32api.SelectClipRgn(FCvsHandle,FCrg); //裁剪区域 + end + end + function Destroy(); + begin + if FW32api and FCvsHandle and FBKrg and FCrg then + begin + FW32api.SelectClipRgn(FCvsHandle,FBKrg); //恢复区域 + FW32api.DeleteObject(FCrg); //销毁区域 + end + FW32api := nil; + end + private + FBKrg; + FCrg; + FCvsHandle; + FW32api; +end implementation type TPAINTCOUNT=class {** @@ -953,12 +979,12 @@ type TPAINTCOUNT=class if v is class(TControl)then begin FPainter := v; - v.BeginUpDate(); + v.IncPaintLock(); end end function Destroy(); begin - if FPainter then FPainter.EndUpDate(); + if FPainter then FPainter.DecPaintLock(); FPainter := nil; end FPainter;