本文介绍了如何使用Mozilla ActiveX控件(axMozillaBrowser1)c#/.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用"axMozillaBrowser1(Mozilla ActiveX Control)"重新加载网页3次但是axMozillaBrowser1控件未加载网页,而正在等待的课程正在正常闪烁,但浏览器控件未加载网页.

i am trying to reload a web page 3 times using "axMozillaBrowser1(Mozilla ActiveX Control)"but axMozillaBrowser1 control is not loading web page and it's waiting courser is blinking regular but browser control is not loading web page.

请告诉我如何正确使用axMozillaBrowser1控件.提前感谢.

Please tell me how to use axMozillaBrowser1 control properly. Thanx in advance.

这是我的程序代码:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        progressBar1.Maximum = 3;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        do
        {
            axMozillaBrowser1.Navigate(textBox1.Text);
            while(axMozillaBrowser1.ReadyState != MOZILLACONTROLLib.tagREADYSTATE.READYSTATE_COMPLETE)
            {
                Application.DoEvents();
                if (axMozillaBrowser1.ReadyState == MOZILLACONTROLLib.tagREADYSTATE.READYSTATE_COMPLETE)
                {
                    progressBar1.Value = progressBar1.Value + 1;
                }
            }
        }while(progressBar1.Value != 3);
    }
}

推荐答案

为什么要导航3次?

但是我的建议是:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        progressBar1.Maximum = 3;
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
             progressBar1.Value = 0;
            axMozillaBrowser1.Navigate(textBox1.Text);
    }

    private void webBrowser2_Navigated(object sender, WebBrowserNavigatedEventArgs e)
    {
        if ( progressBar1.Value < 3 )
        {
            axMozillaBrowser1.Navigate(textBox1.Text);
            progressBar1.Value = progressBar1.Value + 1;
        }

    }
}

这篇关于如何使用Mozilla ActiveX控件(axMozillaBrowser1)c#/.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-25 23:54