how to use 'marquee' to show circular progressbar

G

Guest

Hi,
I have a c# program that needs to show the progressbar which is circular
processbar,just like the one when windows xp loading. I tried below:

private void TimeConsumingOperation(BackgroundWorker bw)
{
int percentComplete...; //???is it right

/*Do something--time consuming work*/

bw.ReportProgress(percentComplete++)//???is it right
}
private void button1_Click(object sender, EventArgs e)
{
this.progressBar1.Style = ProgressBarStyle.Marquee;
this.backgroundWorker1.RunWorkerAsync();

}

private void button2_Click(object sender, EventArgs e)
{
this.backgroundWorker1.CancelAsync();
}

private void backgroundWorker1_ProgressChanged(object sender,
ProgressChangedEventArgs e)
{
this.progressBar1.Value = e.ProgressPercentage;
}

but it does not work, how to solve it?

thanks.
 
J

joachim

Google is your friend:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=257931&SiteID=1

in addition to the answers there:

to neatly reset the progressbar, you can first set the style to blocks
and then set the maximum and the value to 1 and 0:

progressBar1.Style = ProgressBarStyle.Blocks;
progressBar1.Maximum = 1;
progressBar1.Value = 0;

it is a good idea to always change the maximum first and then the
value in order to avoid Exceptions


Regards,
Joachim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top