lcl: grids: fix ranges in GetPxTopLeft. Issue #30184

git-svn-id: trunk@52390 -
This commit is contained in:
ondrej 2016-05-25 14:41:40 +00:00
parent 55188988d4
commit 8999b027ad

View File

@ -2411,14 +2411,14 @@ end;
function TCustomGrid.GetPxTopLeft: TPoint;
begin
if FTopLeft.x < FGCache.AccumWidth.Count then
if (FTopLeft.x >= 0) and (FTopLeft.x < FGCache.AccumWidth.Count) then
Result.x := Integer(PtrUInt(FGCache.AccumWidth[FTopLeft.x]))+FGCache.TLColOff-FGCache.FixedWidth
else if FTopLeft.x > 0 then
Result.x := FGCache.GridWidth+FGCache.TLColOff-FGCache.FixedWidth
else
Result.x := 0;
if FTopLeft.y < FGCache.AccumHeight.Count then
if (FTopLeft.y >= 0) and (FTopLeft.y < FGCache.AccumHeight.Count) then
Result.y := Integer(PtrUInt(FGCache.AccumHeight[FTopLeft.y]))+FGCache.TLRowOff-FGCache.FixedHeight
else if FTopLeft.y > 0 then
Result.y := FGCache.GridHeight+FGCache.TLRowOff-FGCache.FixedHeight