C#/C++/C

CefSharp For WPF隐藏滚动条

2017-12-07  本文已影响0人  Lulus

效果:开始的时候会显示几秒,之后就不会再显示了

<!--浏览器-->
<cefSharpWPF:ChromiumWebBrowser Name="webBrowser"  Grid.Row="0" >
</cefSharpWPF:ChromiumWebBrowser>
public MainWindow()
{
    InitializeComponent();

    webBrowser.FrameLoadEnd += OnBrowserFrameLoadEnd;
}

private void OnBrowserFrameLoadEnd(object sender, FrameLoadEndEventArgs args)
{
    if (args.Frame.IsMain)
    {
        args
            .Browser
            .MainFrame
            .ExecuteJavaScriptAsync(
            "document.body.style.overflow = 'hidden'");
    }
}

参考资料:
https://stackoverflow.com/questions/43742596/how-can-i-get-cefsharp-to-hide-both-the-vertical-and-horizontal-scrollbars-when

上一篇下一篇

猜你喜欢

热点阅读