Ignore:
Timestamp:
Jan 7, 2024, 11:23:36 PM (11 months ago)
Author:
chronos
Message:
  • Fixed: Avoid repeatedly calling Term form resize and repaint in case of fractional scaling.
Location:
trunk/Packages/DpiControls
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/DpiControls/Dpi.Common.pas

    r522 r523  
    8989  uFlags: UINT): Boolean;
    9090begin
    91   LCLIntf.SetWindowPos(hWnd, hWndInsertAfter, ScaleToNative(X), ScaleToNative(Y),
     91  Result := LCLIntf.SetWindowPos(hWnd, hWndInsertAfter, ScaleToNative(X), ScaleToNative(Y),
    9292    ScaleToNative(cx), ScaleToNative(cy), uFlags);
    9393end;
     
    105105function ScaleFromNative(Value: Integer): Integer;
    106106begin
    107   Result := Round(Value * 96 / ScreenInfo.Dpi);
     107  Result := Floor(Value * 96 / ScreenInfo.Dpi);
    108108end;
    109109
  • trunk/Packages/DpiControls/Dpi.Controls.pas

    r482 r523  
    10281028
    10291029procedure TControl.NativeFormResize(Sender: TObject);
    1030 begin
    1031   BoundsRect := ScaleRectFromNative(GetNativeControl.BoundsRect);
     1030var
     1031  R: TRect;
     1032begin
     1033  R := ScaleRectFromNative(GetNativeControl.BoundsRect);
     1034  FLeft := R.Left;
     1035  FTop := R.Top;
     1036  FWidth := R.Width;
     1037  FHeight := R.Height;
    10321038  DoFormResize;
    10331039end;
     
    10701076
    10711077procedure TControl.UpdateBounds;
    1072 var
    1073   R: TRect;
    10741078begin
    10751079  GetNativeControl.BoundsRect := ScaleRectToNative(BoundsRect);
    1076   R := ScaleRectToNative(BoundsRect);
    1077   //WriteLog(Name + ' ' + IntToStr(R.Left) + ', ' + IntToStr(R.Top) + ', ' + IntToStr(R.Width) + ', ' + IntToStr(R.Height))
    10781080end;
    10791081
Note: See TracChangeset for help on using the changeset viewer.