首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

应用Timer控件和进度条

2012-08-14 
使用Timer控件和进度条1.拖入progressBar控件和Timer控件 2.将timer控件属性Interval改为400,Enable属性改

使用Timer控件和进度条

1.拖入progressBar控件和Timer控件 2.将timer控件属性Interval改为400,Enable属性改为false并添加timer1_Tick()处理事件    private void timer1_Tick(object sender, EventArgs e)        {            if (progressBar1.Value >= 100)            {                progressBar1.Value = 0;                label1.Text = "进度" + progressBar1.Value.ToString() + "%";                return;            }            progressBar1.Value += 5;            label1.Text = "进度" + progressBar1.Value.ToString() + "%";        }3.拖入2个button控件,分别将Text属性改为”开始“和“暂停”。  双击“开始”控件,添加timer1.Enable=true;  双击“开始”控件,添加timer1.Enable=false;  4.添加label控件,修改Text属性为“0%” 


 

热点排行