Page 1 of 1

cefsharp c# wpf project

PostPosted: Mon Jun 28, 2021 10:57 am
by rtourangeau
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

Re: cefsharp c# wpf project

PostPosted: Mon Jun 28, 2021 4:19 pm
by amaitland
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?

Re: cefsharp c# wpf project

PostPosted: Tue Jun 29, 2021 9:55 am
by rtourangeau
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

Re: cefsharp c# wpf project

PostPosted: Tue Jun 29, 2021 3:14 pm
by amaitland
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