如题
我主要是不知道他们两个怎么结合的用的,随便举个简单的例子,有个注释,能看懂就给分
多多益善!
谢谢!

解决方案 »

  1.   

    Form上放置timer和Progressbar控件后,复制以下代码,运行试试看
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                if (this.progressBar1.Value < this.progressBar1.Maximum)
                    this.progressBar1.Value += 1;
                else
                    this.progressBar1.Value = this.progressBar1.Minimum;
            }        private void Form1_Load(object sender, EventArgs e)
            {
                this.timer1.Interval = 100;
                this.timer1.Start();
            }
        }
    }
      

  2.   

      private void button1_Click(object sender, EventArgs e)
            {
                this.progressBar1.Maximum = 100;
                this.progressBar1.Step = 1;
                this.timer1.Start();
            }
                    private void timer1_Tick(object sender, EventArgs e)
            {
                
                this.progressBar1.Value = this.progressBar1.Value + 1;
                if (this.progressBar1.Value == this.progressBar1.Maximum)
                {
                    this.timer1.Stop();
                }
            }