美文网首页C#/C++/C
CefSharp For WPF隐藏滚动条

CefSharp For WPF隐藏滚动条

作者: Lulus | 来源:发表于2017-12-07 11:13 被阅读0次

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

    <!--浏览器-->
    <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

    相关文章

      网友评论

        本文标题:CefSharp For WPF隐藏滚动条

        本文链接:https://www.haomeiwen.com/subject/ezhdixtx.html