1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-22 22:17:48 +02:00

Issue #273 fixed

- Added TFMXChromium.ScreenScale property
This commit is contained in:
Salvador Díaz Fau
2020-04-09 18:43:03 +02:00
parent c9b2af2a5e
commit 846aeddd54
8 changed files with 57 additions and 55 deletions

View File

@ -58,7 +58,9 @@ type
protected
function GetParentFormHandle : TCefWindowHandle; override;
function GetParentForm : TCustomForm;
function GetScreenScale : Single;
procedure InitializeDevToolsWindowInfo; virtual;
public
procedure ShowDevTools(inspectElementAt: TPoint);
procedure CloseDevTools;
@ -73,6 +75,8 @@ type
function CreateBrowser(const aWindowName : ustring = ''; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil) : boolean; overload; virtual;
function SaveAsBitmapStream(var aStream : TStream; const aRect : System.Types.TRect) : boolean;
function TakeSnapshot(var aBitmap : TBitmap; const aRect : System.Types.TRect) : boolean;
property ScreenScale : single read GetScreenScale;
end;
// *********************************************************
@ -105,7 +109,9 @@ type
implementation
uses
System.SysUtils, System.Math;
{$IFDEF MSWINDOWS}FMX.Helpers.Win,{$ENDIF}
System.SysUtils, System.Math,
uCEFApplicationCore;
function TFMXChromium.CreateBrowser(const aWindowName : ustring;
const aContext : ICefRequestContext;
@ -150,6 +156,25 @@ begin
TempComp := TempComp.owner;
end;
function TFMXChromium.GetScreenScale : Single;
{$IFDEF MSWINDOWS}
var
TempHandle : TCefWindowHandle;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
TempHandle := GetParentFormHandle;
if (TempHandle <> 0) then
Result := GetWndScale(TempHandle)
else
{$ENDIF}
if (GlobalCEFApp <> nil) then
Result := GlobalCEFApp.DeviceScaleFactor
else
Result := 1;
end;
function TFMXChromium.GetParentFormHandle : TCefWindowHandle;
{$IFDEF MSWINDOWS}
var