如何删除滚动条上的web浏览器中的WPF [英] How to remove scrollbars on WebBrowser in WPF
本文介绍了如何删除滚动条上的web浏览器中的WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用WebBrowser控件在我的应用程序,如:
I am using WebBrowser control in my application like:
<WebBrowser x:Name="wcPlayback" Visibility="Visible" LoadCompleted="wcPlayback_LoadComplete" Margin="0,-4,0,0" Width="960px" Height="619px" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"></WebBrowser>
我做了很多尝试删除滚动条,但失败了。
I did many tries to remove scrollbar but failed.
请帮我。
推荐答案
我用这个code和工作对我来说:
I used this code and worked for me:
<WebBrowser LoadCompleted="wb_LoadCompleted"></WebBrowser>
void wb_LoadCompleted(object sender, NavigationEventArgs e)
{
string script = "document.body.style.overflow ='hidden'";
WebBrowser wb = (WebBrowser)sender;
wb.InvokeScript("execScript", new Object[] { script, "JavaScript" });
}
的一点是,你需要设置溢出:隐藏;
在你的页面的CSS。在code以上是做什么的。
The point is, you need to set overflow: hidden;
in your page css. The code above is doing it.
这篇关于如何删除滚动条上的web浏览器中的WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文