进度条中的WinForms [英] Progress Bar in WinForms
问题描述
我需要2形式之间插入一个进度条,我有一个主窗体,当我点击一个按钮打开一个窗口,我需要等待之前加载的最后一个窗口('因为有很多图片下载就上一个表单),我决定使用一个进度条显示剩余打开请求的窗口时间。 现在,我不知道在$ C C此功能(这是我第一次使用进度栏)$如何实现。 你有什么建议,以帮助我如何计算出这个功能? 感谢您的关注。
i need to insert a progress bar between 2 forms ,i have a Main Form when i click a button to open a window i need wait before to load the last one window ('cos there are many picture to download on the last one Form) and i decide to use a Progress Bar to show the time remaining to open the Window requested. Now i don't know how implement in code this feature (it's the first time i use a Progress Bar) . Do you have any advice to help me how work out this feature? Thanks for your attention.
P.S .Sorry从我的英语不好
P.S .Sorry from my bad english
推荐答案
下面是一个简单的例子......
Here is a simple example....
有ProgressBar类,你应该知道的只有三个成员。最大,最小,和数值属性
There are only three members of the ProgressBar class you should know about. The Maximum, the Minimum, and the Value properties.
您创建一个使用进度构造一个进度条控制。
You create a progress bar control using ProgressBar constructor.
this.progressBar1 = new System.WinForms.ProgressBar();
在进度条的创建情况下,你使用最小和进度的最大属性中设置进度条的范围。
After creating instance of a progress bar you set the range of the progress bar by using Minimum and Maximum properties of the ProgressBar.
progressBar1.Maximum = 200;
progressBar1.Manimum=0;
Step属性用于设置步数在进度条中。
The Step property is used to set number of steps in a progress bar.
progressBar1.Step=20;
Value属性是用来设置状态栏的当前值。
The Value property is used to set the current value of the status bar.
protected void displayProgress (object sender, System.EventArgs e)
{
if (progressBar1.Value >= 200 )
{
progressBar1.Value = 0;
return;
}
progressBar1.Value += 20;
}
这篇关于进度条中的WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!