在VS2005中已经内置了Web浏览器控件!

解决方案 »

  1.   

    Object o = new object();
    this.axWebBrowser1.Navigate(yourURL,ref o,ref o,ref o,ref o);
      

  2.   

    在工具箱里添加/移除项.
    在COM组件中选择Miscrosoft Web....  路径是C:\Winnt\System32\shdocvw.dll.
    添加完成后工具箱中会多一个Miscrosfot Web....的东东.
    这个就是用来在WinForm中显示Web页的.
    在你的代码中写下面的代码就可以了.object missing=Missing.Value;
    this.axWebBrowser1.Navigate("http://www.sina.com",ref missing,ref missing,ref missing,ref missing);
      

  3.   


    点“工具”菜单,然后点击“自定义工具葙”弹出对话框,找到IE控件,单击引用,然后回到主页面,工具葙中已经加入了IE浏览器
    一个例子:
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;namespace oa
    {
    /// <summary>
    /// viewNotice 的摘要说明。
    /// </summary>
    public class viewNotice : System.Windows.Forms.Form
    {
    private AxSHDocVw.AxWebBrowser axWebBrowser1;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;
    public viewNotice()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    int zero=0;
    object ozero=zero;
    string empty="";
    object oempty=empty;
    this.axWebBrowser1 .Navigate ("http://192.168.0.29:8080/notice.jsp?name="+oa.Form1 .stringCurentUser ,
    ref ozero,
    ref oempty,
    ref oempty,
    ref oempty);
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form Designer generated code
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(viewNotice));
    this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
    ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
    this.SuspendLayout();
    // 
    // axWebBrowser1
    // 
    this.axWebBrowser1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    | System.Windows.Forms.AnchorStyles.Left) 
    | System.Windows.Forms.AnchorStyles.Right);
    this.axWebBrowser1.Enabled = true;
    this.axWebBrowser1.Location = new System.Drawing.Point(16, 16);
    this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
    this.axWebBrowser1.Size = new System.Drawing.Size(496, 280);
    this.axWebBrowser1.TabIndex = 0;
    // 
    // viewNotice
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    this.ClientSize = new System.Drawing.Size(528, 317);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
      this.axWebBrowser1});
    this.MaximizeBox = false;
    this.Name = "viewNotice";
    this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
    this.Text = "查看通知";
    ((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
    this.ResumeLayout(false); }
    #endregion
    }
    }
      

  4.   

    可以加发一封Email给我,我有一个详尽的例子给你看!
    [email protected]
      

  5.   

    还是使用vs.net 2005里那个托管的web浏览器控件吧。
      

  6.   

    现在用vs.net2003的多一些吧,用2005的话框架又要重新装
      

  7.   

    统一楼上。Navigate方法就可以了
      

  8.   

    用activeX里的WebBrowser控件就可以,VS2005里的WebBrowser控件是对这个ActiveX控件的包装。这个控件使用起来相当简单,首先在工具箱里(ToolBox)里点鼠标右键选 add/remove items,在出来的窗口中选择COM Components,在其中勾选Microsoft Web Browser。然后向窗体加入一个该控件。在合适的地方(Form_Load或者某个按钮事件)中,添加:
    string pageUrl = "http://...";//你要显示的页面的URL
    object o = System.Reflection.Missing.Value;
    axWebBrowser1.Navigate(pageUrl,ref o,ref o,ref o,ref o);
      

  9.   

    2005中的托管控件也只不过是对WebBrowser这个ActiveX Control的包装。如果程序想运行在.net 1.0或1.1上,直接用这个控件也不错。