TheSwamp
Code Red => .NET => Topic started by: csharpbird on June 24, 2008, 10:36:46 AM
-
The following code wants the progressbar to step 1% one time.But in fact it step 6% one time.
public void Test()
{
ProgressMeter p = new ProgressMeter();
p.Start("Status...");
p.SetLimit(100);
for (int i = 0; i < 100; i++)
{
System.Threading.Thread.Sleep(100);
p.MeterProgress();
}
p.Stop();
}
-
It gets done 6x faster that way. :-)
-
Shouldn't p.MeterProgress() be p.PerformStep() ? That should work, assuming you have p.Step = 1
-
maybe it's dyslexic
-
maybe by the time the PB actually gets re-drawn it has moved 6% ??
-
How to step by 1%?
-
How to step by 1%?
p.Step = 1;
-
There is no Step property for ProgressMeter
-
There is no Step property for ProgressMeter
:oops:
Sorry about that. I misread the code in the first post. I thought you were using a ProgressBar.
-
Try: System.Threading.Thread.Sleep(1000);
-
Have you read Kean Walmsley's blog post on this subject? http://through-the-interface.typepad.com/through_the_interface/2007/05/displaying_a_pr.html
Skip through all the pInvoke stuff down to where it says "Update," and he gets into how to work with the managed ProgressMeter class. He throws an Application.DoEvents() into the end of the loop to "allow AutoCAD to repaint." Makes me think maybe MickD was on the right track.
-
Have you read Kean Walmsley's blog post on this subject? http://through-the-interface.typepad.com/through_the_interface/2007/05/displaying_a_pr.html
Skip through all the pInvoke stuff down to where it says "Update," and he gets into how to work with the managed ProgressMeter class. He throws an Application.DoEvents() into the end of the loop to "allow AutoCAD to repaint." Makes me think maybe MickD was on the right track.
Yes.
P/Invoke is OK.
But with the managed ProgressMeter class,the progress bar can not step smoothly.