|
- using Autodesk.AutoCAD.Runtime;
- using System.Runtime.InteropServices;
- using System.Windows.Forms;
- namespace ProgressMeterTest
- {
- public class Cmds
- {
- [CommandMethod("PB")]
- public void ProgressBarManaged()
- {
- ProgressMeter pm = new ProgressMeter();
- pm.Start("开始,请稍候...");
- pm.SetLimit(100);
- for (int i = 0; i <= 100; i++)
- {
- System.Threading.Thread.Sleep(5);
- pm.MeterProgress();
- Application.DoEvents();
- }
- pm.Stop();
- }
- }
- }
复制代码--------------- 关于进度条的进度和程序进度如何保持一致,还有待研究 -----------------更新 -----------------更新 进度条的另一方法: int nmax=10000;
Utils.SetApplicationStatusBarProgressMeter("正在处理...", 0, nmax);//状态栏进度条
for(int i=0;i<max;i++)
{
//处理代码
Utils.SetApplicationStatusBarProgressMeter(i);//设置进度
}
Utils.RestoreApplicationStatusBar();//恢复状态栏
|
|