From 56373ed329dd7df99b44cdfea7c0136eb74172d1 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 17 Mar 2015 11:42:57 +0000 Subject: [PATCH] fpspreadsheet: Fix row heights incorrectly displayed in WorksheetGrid git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4045 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/fpspreadsheetgrid.pas | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index b8a8e0243..ff79f9099 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -3959,8 +3959,10 @@ end; calculating the row height from the max of the cell heights -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.UpdateRowHeights(AStartIndex: Integer = 0); +const + DELTA = 10; var - i: Integer; + r, r1, r2: Integer; lRow: PRow; h: Integer; begin @@ -3979,14 +3981,20 @@ begin end; EndUpdate; } - for i:=GCache.VisibleGrid.Top to GCache.VisibleGrid.Bottom do begin - h := CalcAutoRowHeight(i); + r1 := Max(FHeaderCount, GCache.VisibleGrid.Top - DELTA); + r2 := Min(RowCount-1, GCache.VisibleGrid.Bottom + DELTA); + for r:=r1 to r2 do + begin if Worksheet <> nil then begin - lRow := Worksheet.FindRow(i - FHeaderCount); + lRow := Worksheet.FindRow(r - FHeaderCount); if (lRow <> nil) then - h := CalcRowHeight(lRow^.Height); - end; + h := CalcRowHeight(lRow^.Height) + else + h := CalcAutoRowHeight(r); + end else + h := DefaultRowHeight; + RowHeights[r] := h; end; end;