You've already forked lazarus-ccr
fpspreadsheet: Fix painting artefacts of TsWorksheetGrid when resizing col widths or row heights by dragging with mouse.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4443 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -193,6 +193,7 @@ type
|
|||||||
function GetEditText(ACol, ARow: Integer): String; override;
|
function GetEditText(ACol, ARow: Integer): String; override;
|
||||||
function GetDefaultHeaderColWidth: Integer;
|
function GetDefaultHeaderColWidth: Integer;
|
||||||
function HasBorder(ACell: PCell; ABorder: TsCellBorder): Boolean;
|
function HasBorder(ACell: PCell; ABorder: TsCellBorder): Boolean;
|
||||||
|
procedure HeaderSizing(const IsColumn:boolean; const AIndex,ASize:Integer); override;
|
||||||
procedure HeaderSized(IsColumn: Boolean; AIndex: Integer); override;
|
procedure HeaderSized(IsColumn: Boolean; AIndex: Integer); override;
|
||||||
procedure InternalDrawTextInCell(AText: String; ARect: TRect;
|
procedure InternalDrawTextInCell(AText: String; ARect: TRect;
|
||||||
ACellHorAlign: TsHorAlignment; ACellVertAlign: TsVertAlignment;
|
ACellHorAlign: TsHorAlignment; ACellVertAlign: TsVertAlignment;
|
||||||
@ -611,6 +612,8 @@ type
|
|||||||
{@@ inherited from ancestors}
|
{@@ inherited from ancestors}
|
||||||
property OnHeaderSized;
|
property OnHeaderSized;
|
||||||
{@@ inherited from ancestors}
|
{@@ inherited from ancestors}
|
||||||
|
property OnHeaderSizing;
|
||||||
|
{@@ inherited from ancestors}
|
||||||
property OnKeyDown;
|
property OnKeyDown;
|
||||||
{@@ inherited from ancestors}
|
{@@ inherited from ancestors}
|
||||||
property OnKeyPress;
|
property OnKeyPress;
|
||||||
@ -3224,6 +3227,46 @@ begin
|
|||||||
Result := ABorder in Worksheet.ReadCellBorders(ACell);
|
Result := ABorder in Worksheet.ReadCellBorders(ACell);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
HeaderSizing is called while a column width or row height is resized by the
|
||||||
|
mouse. Is overridden here to enforce a grid repaint if merged cells are
|
||||||
|
affected by the resizing column/row. Otherwise parts of the merged cells would
|
||||||
|
not be updated if the cell text moves during the resizing action.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsCustomWorksheetGrid.HeaderSizing(const IsColumn:boolean;
|
||||||
|
const AIndex,ASize:Integer);
|
||||||
|
var
|
||||||
|
gc, gr: Integer;
|
||||||
|
sc, sr, sr1, sr2, sc1, sc2, si: Cardinal;
|
||||||
|
cell: PCell;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if Worksheet = nil then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
// replaint the grid if merged cells are affected by the resizing col/row.
|
||||||
|
si := IfThen(IsColumn, GetWorksheetCol(AIndex), GetWorksheetRow(AIndex));
|
||||||
|
for gc := GetFirstVisibleColumn to GetLastVisibleColumn do
|
||||||
|
begin
|
||||||
|
sc := GetWorksheetCol(gc);
|
||||||
|
for gr := GetFirstVisibleRow to GetLastVisibleRow do
|
||||||
|
begin
|
||||||
|
sr := GetWorksheetRow(gr);
|
||||||
|
cell := Worksheet.FindCell(gr, gc);
|
||||||
|
if Worksheet.IsMerged(cell) then begin
|
||||||
|
Worksheet.FindMergedRange(cell, sr1, sc1, sr2, sc2);
|
||||||
|
if IsColumn and InRange(si, sc1, sc2) or
|
||||||
|
(not IsColumn) and InRange(si, sr1, sr2) then
|
||||||
|
begin
|
||||||
|
InvalidateGrid;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Inherited from TCustomGrid. Is called when column widths or row heights
|
Inherited from TCustomGrid. Is called when column widths or row heights
|
||||||
have changed. Stores the new column width or row height in the worksheet.
|
have changed. Stores the new column width or row height in the worksheet.
|
||||||
|
Reference in New Issue
Block a user