WPF CefSharp.Wpf 窗体透明
WPF CefSharp.Wpf 窗体透明
参考网站:https://github.com/cefsharp/CefSharp/wiki/General-Usage#3-how-do-you-expose-a-net-class-to-javascript
实例下载:WpfAppSvga.zip
一、窗体透明
1、允许窗体透明
<Window WindowStyle="None" WindowState="Normal" AllowsTransparency="True"/>
2、设置窗体透明
<Window.Background> <SolidColorBrush Opacity="0"></SolidColorBrush> </Window.Background>
二、导入 CefSharp.Wpf
1、CefSharp.Wpf
<Window xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"/>
2、加载网页
<cef:ChromiumWebBrowser x:Name="_wb" Address="file:///C:/HTMLDocumentWithScript.html"/>
3、设置网页透明
html, body { margin: 0px; height: 100%; width: 100%; overflow: hidden; background: rgba(0, 0, 0, 0); }
三、加载本地HTML
WebBrowser.Address = AppDomain.CurrentDomain.BaseDirectory + @"HTMLDocumentWithScript.html";