The main problem I see is that you are telling your UI thread to sleep. This may not be an issue if the delay is low enough, though.
Instead of using <= and >= just use =, since your increment (or decrement) is only one pixel.
Another thought is since you are sleeping for 1 millisecond and the panel is only 100 pixels high, this would mean it would take 100 milliseconds to complete. If it takes longer than this then your code is slowing down. It is not bad that your code slows the process, but on a faster computer the same process might take less time.
Those are just thoughts.




Reply With Quote