RT。假如现有10个网页链接。1. www.baidu.com
2. www.google.com
3. www.yahoo.cn
4. www.sogou.com
5. www.youdao.com
6. www.sina.com
7. www.163.com
8. www.sohu.com
9. www.alibaba.com
10.www.cctv.com现要求只用Timer、webBrowser控件实现每隔10秒WebBrowser依次加载一个网页,改怎么实现?

解决方案 »

  1.   

    把地址放到一个数组里string[] url
    用TIMER控制WebBrowser的地址为url[i]
    i=(i+1)%10;
      

  2.   

    timetick时,webbrowser打开一个网址喽。
      

  3.   

    在循环语句中执行WebBrowser.Navigate() 每次循环等待网页加载完后再继续执行
      

  4.   

    将要打开的网页放在一个数组里面str[];
    用个全局变量int i;
    timer_click事件里写:
    先打开str[i];
    i++;
    if(i>=str.length)
    {
     i=0;
    }
      

  5.   

    你是要做木马么?自动打开那么多网页干吗?小心GOOGLE封了你的账号
      

  6.   

    ...把网址放到数组里,timer时间到了就往下,到了10就从头开始,
    至于中间要不要等网页加载完看你自己的需要了。
      

  7.   

    看看我这个符合你的要求不?using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WebBrowerTest
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            string[] urlArray = { "http://www.baidu.com", "http://www.google.com", "http://www.yahoo.cn", "http://www.sogou.com", "http://www.youdao.com" };
            int curIndex=0;
            int tick = 0;
            private void Form1_Load(object sender, EventArgs e)
            {
                this.timer1.Start();
                webBrowser1.Navigate(urlArray[curIndex]);
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                //是否完成
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    tick++;
                    if (tick >= 10)//到达10秒,更换网址
                    {
                        tick = 0;
                        curIndex++;
                        this.label1.Text = "当前网址:"+urlArray[curIndex];
                        this.webBrowser1.Navigate(urlArray[curIndex]);
                        if (curIndex > urlArray.Length)//如果超过总的个数则从头再来
                        {
                            curIndex = 0;
                        }
                    }
                }
            }
        }
    }
      

  8.   

                //urlArray初始化略
                Timer timer = new Timer();
                timer.Tick += new EventHandler(timer_Tick);
                timer.Interval = 10000;
                timer.Start(); private void timer_Tick(object sender, EventArgs e)
            {
              
                 this.webBrowser1.Navigate(urlArray[curIndex]);
                 curIndex++;              
            }
      

  9.   

     public Form1()
            {
                InitializeComponent();
            }
    我写到这个里面了
      

  10.   

    更改下//是否完成
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    tick++;
                    if (tick >= 10)//到达10秒,更换网址
                    {
                        tick = 0;
                        this.label1.Text = "当前网址:"+urlArray[curIndex];
                        this.webBrowser1.Navigate(urlArray[curIndex]);
                        curIndex++;
                        if (curIndex >= urlArray.Length)//如果超过总的个数则从头再来
                        {
                            curIndex = 0;
                        }
                    }
                }