进度条控件的使用

利用ProgressBar控件显示进度条,并利用Timer控件更新进度条中的进度,程序运行窗口如下。

20120408184632

 

程序代码如下所示。

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 eg32_progBarApp
{
    public partial class 进度条 : Form
    {
        public 进度条()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (progressBar1.Value >= 200)
            {
                progressBar1.Value = 0;
                return;
            }
            progressBar1.Value += 20;
        }
    }
}
作者:codee
文章千古事,得失寸心知。


原文地址:https://www.cnblogs.com/bimgoo/p/2436360.html