cefsharp c# wpf project

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

cefsharp c# wpf project

Postby rtourangeau » Mon Jun 28, 2021 10:57 am

Hi,

I would like to be able tu set the zoom a 100% and hide the side bar.

I tried SetZoomLevel and ZoomLevel and nothing changed the zoom is always 60%

Thanks
rtourangeau
Newbie
 
Posts: 2
Joined: Mon Jun 28, 2021 10:48 am

Re: cefsharp c# wpf project

Postby amaitland » Mon Jun 28, 2021 4:19 pm

ZoomLevel defaults to 100%. Please provide a code example of what you have tried and how you are getting a value of 60%.

What side bar are you referring to?
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: cefsharp c# wpf project

Postby rtourangeau » Tue Jun 29, 2021 9:55 am

This is my code.

-- code behind C# WPF
public winVisualisation()
{
InitializeComponent();

Cef.EnableHighDPISupport();
WebBPDFVisualiser.IsBrowserInitializedChanged += OnBrowserInitialized;
}
private void OnBrowserInitialized(object sender, DependencyPropertyChangedEventArgs e)
{
if (WebBPDFVisualiser.IsBrowserInitialized)
{
WebBPDFVisualiser.SetZoomLevel(2);
WebBPDFVisualiser.NotifyDpiChange(2);
}
}



--XMAL header
<Window x:Class="DocNumerique.Win.winVisualisation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
Title="Visualisation d'un document" Height="925" Width="1275" LocationChanged="Window_LocationChanged" Loaded="Window_Loaded"
WindowStartupLocation="Manual" WindowState="Maximized" ResizeMode="NoResize" Closed="Window_Closed" WindowStyle="None" ShowInTaskbar="False">

--XMAL tag
<cefSharp:ChromiumWebBrowser Name="WebBPDFVisualiser" Visibility="Visible" Grid.Column="2" Margin="10,10,5,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" OpacityMask="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" />


Thanks
rtourangeau
Newbie
 
Posts: 2
Joined: Mon Jun 28, 2021 10:48 am

Re: cefsharp c# wpf project

Postby amaitland » Tue Jun 29, 2021 3:14 pm

What are you calling NotifyDpiChange for?

NotifyDpiChange should be called in response to the DPI changing.
https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 14 guests