webbrowser控件如何禁用滚动条呢?

xiaohefeng 2003-07-08 12:24:12
显示网页时总有滚动条,想把它隐藏掉。
谢谢。
...全文
663 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2003-07-08
  • 打赏
  • 举报
回复
关键:
private void axWebBrowser1_DownloadComplete(object sender, System.EventArgs e)
{
IHTMLDocument2 HTMLDocument =(IHTMLDocument2) axWebBrowser1.Document;
HTMLDocument.body.style.overflow = "hidden";

}
孟子E章 2003-07-08
  • 打赏
  • 举报
回复
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using mshtml;
namespace WebBrowser
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser axWebBrowser1;
private System.Windows.Forms.TextBox textBox1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
this.textBox1 = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
this.SuspendLayout();
//
// axWebBrowser1
//
this.axWebBrowser1.Enabled = true;
this.axWebBrowser1.Location = new System.Drawing.Point(64, 40);
this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
this.axWebBrowser1.Size = new System.Drawing.Size(300, 150);
this.axWebBrowser1.TabIndex = 4;
this.axWebBrowser1.DownloadComplete += new System.EventHandler(this.axWebBrowser1_DownloadComplete);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(80, 216);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 5;
this.textBox1.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(528, 373);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox1,
this.axWebBrowser1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
object Zero = 0;
object EmptyString = "";

axWebBrowser1.Navigate("http://xml.sz.luohuedu.net/xml/Content.asp",ref Zero, ref EmptyString, ref EmptyString, ref EmptyString);
}


private void axWebBrowser1_DownloadComplete(object sender, System.EventArgs e)
{
IHTMLDocument2 HTMLDocument =(IHTMLDocument2) axWebBrowser1.Document;
HTMLDocument.body.style.overflow = "hidden";
this.textBox1.Text = "ok";
}

}
}
xiaohefeng 2003-07-08
  • 打赏
  • 举报
回复
多谢。
我现在的水平根本想不到这一步,有点自卑。哈哈。

111,096

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧