Fixed a size issue in SimpleFMXBrowser with a high DPI screen

This commit is contained in:
salvadordf 2021-12-03 18:34:44 +01:00
parent 25edba76e8
commit 3fef420fff
3 changed files with 19 additions and 6 deletions

View File

@ -78,6 +78,13 @@ object SimpleFMXBrowserFrm: TSimpleFMXBrowserFrm
Left = 40
Top = 192
end
object BrowserLay: TLayout
Align = Client
Size.Width = 1000.000000000000000000
Size.Height = 565.000000000000000000
Size.PlatformDefault = False
TabOrder = 6
end
object FMXChromium1: TFMXChromium
OnBeforeContextMenu = FMXChromium1BeforeContextMenu
OnContextMenuCommand = FMXChromium1ContextMenuCommand

View File

@ -66,6 +66,7 @@ type
Layout1: TLayout;
GoBtn: TButton;
SnapShotBtn: TButton;
BrowserLay: TLayout;
procedure GoBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
@ -377,6 +378,7 @@ begin
begin
FClosing := True;
Visible := False;
FMXChromium1.CloseBrowser(True);
end;
end;
@ -403,10 +405,10 @@ var
TempScale : single;
begin
TempScale := FMXChromium1.ScreenScale;
Result.Left := 0;
Result.Top := round(AddressPnl.Height * TempScale);
Result.Right := round(ClientWidth * TempScale) - 1;
Result.Bottom := round(ClientHeight * TempScale) - 1;
Result.Left := round(BrowserLay.Position.x);
Result.Top := round(BrowserLay.Position.y);
Result.Right := Result.Left + round(BrowserLay.Width * TempScale);
Result.Bottom := Result.Top + round(BrowserLay.Height * TempScale);
end;
procedure TSimpleFMXBrowserFrm.ResizeChild;
@ -473,7 +475,9 @@ begin
TempRect.Bottom := round(TempClientRect.Bottom);
FMXChromium1.DefaultUrl := AddressEdt.Text;
if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then Timer1.Enabled := True;
if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then
Timer1.Enabled := True;
end;
end;
@ -487,7 +491,9 @@ var
PositionChanged: Boolean;
begin
PositionChanged := (ALeft <> Left) or (ATop <> Top);
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
if PositionChanged then
NotifyMoveOrResizeStarted;
end;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 338,
"InternalVersion" : 339,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "96.0.16.0"
}