mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 15:58:07 +02:00
Designer: TScrollingWinControl paints design-time grid only on visible area. Issue #39866. Based on work by German forum user "siro".
(cherry picked from commit b9c4368fce
)
This commit is contained in:
parent
ed085d959f
commit
8c898cd63a
@ -3185,6 +3185,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function RoundToMultiple(AValue, ABasis: Integer): Integer; inline;
|
||||
begin
|
||||
Result := AValue div ABasis * ABasis;
|
||||
end;
|
||||
|
||||
procedure TDesigner.PaintClientGrid(AWinControl: TWinControl;
|
||||
aDDC: TDesignerDeviceContext);
|
||||
var
|
||||
@ -3192,6 +3197,8 @@ var
|
||||
Count: integer;
|
||||
i: integer;
|
||||
CurControl: TControl;
|
||||
R, R1: TRect;
|
||||
P: TPoint;
|
||||
begin
|
||||
if (AWinControl=nil)
|
||||
or (not (csAcceptsControls in AWinControl.ControlStyle))
|
||||
@ -3218,8 +3225,11 @@ begin
|
||||
ADDC.Canvas.Pen.Color := GridColor;
|
||||
ADDC.Canvas.Pen.Width := 1;
|
||||
ADDC.Canvas.Pen.Style := psSolid;
|
||||
DrawGrid(ADDC.Canvas.Handle, TWinControlAccess(AWinControl).GetLogicalClientRect,
|
||||
GridSizeX, GridSizeY);
|
||||
P := TWinControlAccess(AWinControl).GetClientScrollOffset;
|
||||
R := AWinControl.ClientRect;
|
||||
R.BottomRight := R.BottomRight + Point(GridSizeX, GridSizeY);
|
||||
OffsetRect(R, RoundToMultiple(P.X, GridSizeX), RoundToMultiple(P.Y, GridSizeY));
|
||||
DrawGrid(ADDC.Canvas.Handle, R, GridSizeX, GridSizeY);
|
||||
end;
|
||||
|
||||
if ShowBorderSpacing then
|
||||
|
Loading…
Reference in New Issue
Block a user