C#进度条 请问各位,C#怎么写一个进度条?有时候加密文件比较大的时候要用的时间也比较长,所以想用一个进度条来显示加密的进度,要进度条自己根据实际显示的那种,小弟初学,不太懂,请各位给出代码研究一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ProgressBarhttp://msdn.microsoft.com/zh-cn/library/system.windows.controls.progressbar(VS.95).aspx 1.先必须声明一个委托 delegate void ShowProgressDelegate(int minStep, int totalStep, int currentStep);2.写一个对于的方法来调用委托 // 显示进度条 void ShowProgress(int minStep, int totalStep, int currentStep) { this.tspsBoxBar.Minimum = minStep; this.tspsBoxBar.Maximum = totalStep; this.tspsBoxBar.Value = currentStep; this.xftslblValue.Text = 100 * currentStep / totalStep + "%"; (lbl显示的百分数) } 3.添加一个ProgressBar(进度条) 4.将方法实例化为委托 ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress); // 显示进度条 this.Invoke(showProgress, new object[] { startCode, endCode, i }); 加密文件比较大,这就是个思路啥。 直接得到加密文件byte的length, progressBar.Maximum = length ; progressBar.Minimum = 0; progressBar.Value = 0; 然后while循环往stream写的时候就progressBar.Value+=10啊8的随便你。要是快,就不显示,慢就会显示出来。 楼主,你去书上找关于控件ProgressBar的知识看看,肯定会了。顶一个,一起学习之! 看一下winform 之类的书 肯定就会了 ProgressBar 楼主看看它的用法就知道怎么弄了。。 GetGraphicsPath的头文件 【求解】C#项目的文件夹 C#做一个禁止登录QQ等程序 一个动态建立控件的问题,很急!!! 我这条件查询的语句对不对? c#Combobox使用了数据绑定后如何更新 在求使用PluginInstaller.msi插件打包C#开发的WinForm程序的方法和步骤 很容易得分的 正则表达式替换 " 新手疑问,搞不懂的C#生成的asp web application c#字符串操作 求一个正则表达式
http://msdn.microsoft.com/zh-cn/library/system.windows.controls.progressbar(VS.95).aspx
delegate void ShowProgressDelegate(int minStep, int totalStep, int currentStep);
2.写一个对于的方法来调用委托
// 显示进度条
void ShowProgress(int minStep, int totalStep, int currentStep)
{
this.tspsBoxBar.Minimum = minStep;
this.tspsBoxBar.Maximum = totalStep;
this.tspsBoxBar.Value = currentStep;
this.xftslblValue.Text = 100 * currentStep / totalStep + "%";
(lbl显示的百分数)
}
3.添加一个ProgressBar(进度条)
4.将方法实例化为委托
ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress);
// 显示进度条
this.Invoke(showProgress, new object[] { startCode, endCode, i });
直接得到加密文件byte的length,
progressBar.Maximum = length ;
progressBar.Minimum = 0;
progressBar.Value = 0;
然后while循环往stream写的时候就progressBar.Value+=10啊8的随便你。要是快,就不显示,慢就会显示出来。