Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Setting screen and windows dimentions in old CEF
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Setting screen and windows dimentions in old CEF
There are OnGetViewRect and OnGetScreenInfo events in newer versions, but there is only 1st event in my version.
Using Demo code, I can set equal screen resolution and window's dimensions.
How can I set different resolution and dimension?
Thanks.
Using Demo code, I can set equal screen resolution and window's dimensions.
How can I set different resolution and dimension?
Thanks.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Setting screen and windows dimentions in old CEF
Using TChromium.OnGetViewRect you can configure CEF to use a surface with different dimmensions than your form to draw the web contents.
Read this page for more information about those events :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
Read this page for more information about those events :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
Re: Setting screen and windows dimentions in old CEF
This only works in the OSR version, doesn't it?)salvadordf wrote: Wed Aug 12, 2020 7:10 am Using TChromium.OnGetViewRect you can configure CEF to use a surface with different dimmensions than your form to draw the web contents.
For the normal version only by script(
viewtopic.php?f=8&t=1382&p=5744#p5744
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Setting screen and windows dimentions in old CEF
That's correct. All those events only work in OSR mode.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Setting screen and windows dimentions in old CEF
You are right, I am using OSR component. And want to set the size of screen and window.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Setting screen and windows dimentions in old CEF
Please help me
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Setting screen and windows dimentions in old CEF
If the CEF version you use doesn't have the OnGetScreenInfo event then you can't set a custom screen resolution.
You need to use a newer CEF version.
You need to use a newer CEF version.
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Setting screen and windows dimentions in old CEF
It was my know-howdilfich wrote: Wed Aug 12, 2020 8:30 am For the normal version only by script(
viewtopic.php?f=8&t=1382&p=5744#p5744
Re: Setting screen and windows dimentions in old CEF
Code: Select all
// Screen resolution
procedure GetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
var
TempRect : TCEFRect;
begin
if (GlobalCEFApp <> nil) then
begin
TempRect.x := 0;
TempRect.y := 0;
TempRect.width := ScreenWidth[FCefID];
TempRect.height := ScreenHeight[FCefID];
screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor;
screenInfo.depth := 0;
screenInfo.depth_per_component := 0;
screenInfo.is_monochrome := Ord(False);
screenInfo.rect := TempRect;
screenInfo.available_rect := TempRect;
Result := True;
end
else
Result := False;
end;
// Browser's resolution
procedure GetViewRect(Sender : TObject; const browser : ICefBrowser; var rect : TCefRect);
begin
if (GlobalCEFApp <> nil) then
begin
rect.x := 0;
rect.y := 0;
rect.width := BrowsrWidth[FCefID];
rect.height := BrowsrHeight[FCefID];
end;
end;
-
- Posts: 112
- Joined: Wed Jul 01, 2020 10:22 am
Re: Setting screen and windows dimentions in old CEF
Thanks, it works.