-2

I have a windows form with 2 timers. One of them controls the scrolling text at the bottom, while the other changes pictures in a PictureBox. The problem is that when the first timer's tick event occurs and changes the picture, the horizontally scrolling text stops for around a tenth of a second and then starts scrolling again. I just need to know a way to avoid that.

neminem
  • 2,658
  • 5
  • 27
  • 36
T-X
  • 145
  • 1
  • 9
  • 1
    Please provide concise, relevant code to reproduce the problem you're seeing. There are likely many things that could contribute to your problem, and seeing the code will help us find that more easily. – beatgammit Jul 09 '14 at 18:40
  • Displaying a large bitmap that needs to be rescaled to fit the picture box can swallow a tenth of a second. You probably need a BackgroundWorker to pre-scale it. – Hans Passant Jul 09 '14 at 18:51

1 Answers1

-1

Use Application.DoEvents Method inside first timer, read that.

ooopsoft
  • 410
  • 2
  • 6
  • 3
    Don't use Application.DoEvents. – Victor Zakharov Jul 09 '14 at 18:42
  • According to information provided by question, maybe is not too bad to try the DoEvents Method. i don't understand the aggressive "Don't use" :) – ooopsoft Jul 10 '14 at 09:30
  • Using Application.DoEvents can introduce other issues. It's like taking a loaded gun with you when you sleep. There are safer ways to solve it usually. – Victor Zakharov Jul 10 '14 at 11:10
  • @Neolisk, for this reason I provide in my reply the **[link](http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1)**, so user can decide. in my opinion there are no good or bad commands, just bad use. – ooopsoft Jul 10 '14 at 12:05
  • If something can be used badly, it will be used badly. This is human nature. As a responsible software engineer, you should avoid recommending technologies without a disclaimer. http://blog.codinghorror.com/is-doevents-evil/ – Victor Zakharov Jul 10 '14 at 13:35
  • 1
    Oh yeah!, Murphy's Law. – ooopsoft Jul 10 '14 at 15:03