当前位置:编程学习 > C#/ASP.NET >>

webbrowser滚动条问题

vs2008,C#我在winform里加入webbrowser控件,想取消底部和右边的滚动条以及边框,做一个全屏的浏览器,用在触摸屏幕上,该怎么做啊?我的代码如下:
public Form1()
        {
            InitializeComponent();
            webBrowser1.Navigate("file:///F:/web/index.html");
            webBrowser1.GoForward();
            this.SetVisibleCore(false);
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
            this.AutoScroll = false;
            this.VScroll = false;
            this.HScroll = false;
            this.SetVisibleCore(true);
                       
        }
各位大哥,帮帮忙啊!不胜感激!!! --------------------编程问答--------------------
webbrowser.Dock=DockStyle.Fill;
--------------------编程问答-------------------- An empty scroll bar and sometimes a border appear if the following conditions are true: 
You display a frameset in an application that hosts the WebBrowser control. -and-


You navigate to a frame in the frameset elsewhere in the BeforeNavigate or the BeforeNavigate2 event handler.
These items should not appear in the frame

To work around the problem with the scroll bar, use one of the following methods: 
In the HTML source for the frame page, manually add the "auto" or the "no" value to the scroll attribute in the <body> tag.
Add the scroll attribute dynamically through Dynamic HTML (DHTML).
Delay the navigation by posting a user-defined message and by performing the navigation in the user-defined message handler.
To work around the problem with the border, use one of the following methods: 
Post a user-defined message, and then perform the navigation in the user-defined message handler.
Implement the IDocHostUIHandler interface, and then return DOCHOSTUIFLAG_NO3DBORDER in the GetHostInfo method.
谢谢各位,我终于找到了! --------------------编程问答-------------------- private   void   axWebBrowser1_DownloadComplete(object   sender,   System.EventArgs   e) 

IHTMLDocument2   HTMLDocument   =(IHTMLDocument2)   axWebBrowser1.Document; 
HTMLDocument.body.style.overflow   =   "hidden "; 


--------------------编程问答-------------------- 如何隐藏WebBrowser控件的边框与滚动条(转) 

 

当我们在程序窗体中要显示网页的内容,我们当然首选是WebBrowser控件,可是有时候因为美观的需要,我们要去掉WebBrowser的边框与滚动条,解决的方法是使用CSS样式表。

如果我们可以修改要显示的网页代码,则可以直接在网页的头(head)部分中加入<style>BODY{ border:0px; overflow:hidden; }</style>即可。如果网页代码不能修改,我们则可以使用代码动态修改样式而达到目的,代码如下:

Dim WB As WebBrowser
Set WB = Me.WebBrowser1.Object
WB.Document.body.Style.border = "0px" '隐藏边框
WB.Document.body.Style.overflow = "hidden" '隐藏滚动条
WB.Document.body.Style.margin = "0px" '修改网页边距为0
............

事实上我可以只要参照DOM对应的样式控件语法修改好了

 
 
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,