Freigeben über


Using a ProgressBar control

 Hiya all.

I recenlty made a cheezy test program to just roll dice.  I put a ProgressBar control to show give the end user an idea of how many rolls are left.

Well, I noticed that when I tried to do 10000 consecutive rolls, the program slows waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay down.  When I had this all setup as a console app, it screamed no matter how many times I tried to roll the die.  I'm guessing this perf hit is because of the UI in general, but is there anything I can do to speed this up?  Is this something that someone would use threading on to improve perf?

Thanks in advance to anyone who answers.  :)

Comments

  • Anonymous
    January 28, 2006
    I would certainly use another thread. Have one thread handle the rolling of the dice and the other handle the UI.
  • Anonymous
    January 28, 2006
    Be careful not to starve the UI thread. Read this for more information:

    http://blogs.msdn.com/jfoscoding/archive/2005/10/30/487043.aspx
  • Anonymous
    January 29, 2006
    If you really expect it to scream through a lot of rolls, only update a percentage of the rolls (every 10, or every 100)... It'll still show enough progress to be meaningful.
  • Anonymous
    January 30, 2006
    Hard to say without seeing the code...