OK, SetTopLeft ändert ja auch ViewPortPosition.
Allerdings hat TGrid OnViewPortpositionChange nicht published... ich suche es mal
Delphi-Quellcode:
procedure TStyledGrid.SetTopLeft(const ACol, ARow: Integer);
var
R: TRect;
LCol, LRow: Integer;
begin
if ((ACol >= 0) or (ARow >= 0)) and (ACol < Model.ColumnCount) and (ARow < Model.RowCount) then
begin
LCol := Max(0, ACol);
LRow := Max(0, ARow);
R := CellRect(LCol, LRow);
AniCalculations.BeginUpdate;
try
if not AniCalculations.Down then
AniCalculations.MouseDown(0, 0);
AniCalculations.MouseLeave;
if ACol < 0 then
ViewportPosition := TPointF.Create(ViewportPosition.X, R.Top)
else if ARow < 0 then
ViewportPosition := TPointF.Create(R.Left, ViewportPosition.Y)
else
ViewportPosition := TPointF.Create(R.Left, R.Top);
finally
AniCalculations.EndUpdate;
end;
AniCalculations.UpdatePosImmediately(True);
end;
end;