CefSharp For WPF隐藏滚动条

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




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

你可能感兴趣的:(CefSharp For WPF隐藏滚动条)