C# 进度条封装

主要是使用BackgroundWorker控件实现异步刷新…… public class ProgressTool { private BackgroundWorker backgroundWorkerProgress; public ProgressTool() { // // backgroundWorkerProgress // this.backgroundWorkerProgress = new System.ComponentModel.BackgroundWorker(); this.backgroundWorkerProgress.WorkerReportsProgress = true; this.backgroundWorkerProgress.WorkerSupportsCancellation = true; this.backgroundWorkerProgress.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerProgress_DoWork); this.backgroundWorkerProgress.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorkerProgress_RunWorkerCompleted); } public void StartBar(Form dialog, int maxVal)

批处理获取日期生成压缩包

首先是获取系统时间 原生的方法获取到的系统时间有中文(这个和操作系统的时间设置有关系),所以需要做一些截取。 原始的变量%Date%得到的字符串