fpspreadsheet: Fix WorksheetGrid cell painting in RTL mode being offset by 1 pixel and erasing grid lines

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5809 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2017-03-18 21:50:51 +00:00
parent 06d6acfe2b
commit 932290dee9

View File

@ -1902,8 +1902,9 @@ procedure TsCustomWorksheetGrid.DrawAllRows;
var var
cliprect: TRect; cliprect: TRect;
rgn: HRGN; rgn: HRGN;
tmp: Integer = 0; //tmp: Integer = 0;
fc, fr: Integer; //fc, fr: Integer;
TL: TPoint;
begin begin
inherited; inherited;
@ -1914,23 +1915,14 @@ begin
if (FrozenRows > 0) or (FrozenCols > 0) then if (FrozenRows > 0) or (FrozenCols > 0) then
DrawFrozenPanes; DrawFrozenPanes;
// Avoid painting into the header cells // Set cliprect for scrollable grid area
cliprect := ClientRect; cliprect := ClientRect;
TL := CalcTopLeft(false);
fc := FHeaderCount + FFrozenCols; if IsRightToLeft then
if fc > 0 then cliprect.Right := TL.X
if IsRightToLeft then else
ColRowToOffset(True, true, fc-1, cliprect.Right, tmp) cliprect.Left := TL.X;
else cliprect.Top := TL.Y;
begin
ColRowToOffset(True, True, fc-1, tmp, cliprect.Left);
// dec(clipRect.Left); // wp!!!
end;
fr := FHeaderCount + FFrozenRows;
if fr > 0 then begin
ColRowToOffset(False, True, fr-1, tmp, cliprect.Top);
// dec(cliprect.Top); // wp!!!
end;
DrawFrozenPaneBorders(clipRect); DrawFrozenPaneBorders(clipRect);
@ -1939,8 +1931,10 @@ begin
DrawCellBorders; DrawCellBorders;
DrawSelection; DrawSelection;
DrawImages(DRAW_NON_FROZEN); DrawImages(DRAW_NON_FROZEN);
//DrawFrozenPaneBorders(clipRect);
DeleteObject(rgn); DeleteObject(rgn);
finally finally
Canvas.RestoreHandleState; Canvas.RestoreHandleState;
end; end;
@ -4140,13 +4134,13 @@ begin
end; end;
end; end;
temp_rct := AClipRect;
rct := CellRect(gc, gr, gcNext-1, gr); rct := CellRect(gc, gr, gcNext-1, gr);
rct.Top := temp_rct.Top; rct.Top := AClipRect.Top;
rct.Bottom := temp_rct.Bottom; rct.Bottom := AClipRect.Bottom;
if (rct.Left < rct.Right) and HorizontalIntersect(rct, clipArea) then if (rct.Left < rct.Right) and HorizontalIntersect(rct, clipArea) then
begin begin
temp_rct := rct;
// if IsRightToLeft then dec(rct.Right); // wp: There's still a 1-pixel gap in the dark fixed-cell border // if IsRightToLeft then dec(rct.Right); // wp: There's still a 1-pixel gap in the dark fixed-cell border
gds := GetGridDrawState(gc, gr); gds := GetGridDrawState(gc, gr);
// Draw cell // Draw cell