From 29481d93823feedd9271c2cace35cd999c10c444 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 13 May 2017 12:41:03 +0000 Subject: [PATCH] fpspreadsheet: Improved painting of WorksheetGrid's FocusRect (priority to stay inside the cell). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5854 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/visual/fpspreadsheetgrid.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index 2d78e0cb8..97456e62c 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -2850,7 +2850,7 @@ var R: TRect; cell: PCell; r1,c1,r2,c2: Cardinal; - //delta: Integer; + delta: Integer; savedPenMode: TPenMode; begin if Worksheet = nil then @@ -2865,9 +2865,15 @@ begin end else R := CellRect(Selection.Left, Selection.Top, Selection.Right, Selection.Bottom); + // Draw focus rect inside + delta := Max(FSelPen.Width div 2, 0); + inc(R.Top, delta); + if IsRightToLeft then dec(R.Right, delta) else inc(R.Left, delta); + + { dec(R.Top); if IsRightToLeft then inc(R.Right) else dec(R.Left); - + } // Cosmetics at the edges of the grid to avoid spurious rests { delta := Max(FSelPen.Width div 2, 0);