I have a program which needs to do two separate functions simultaneously. The first is updating the picturebox with a new Bitmap, the second function is a simple function which is effectively instantaneous.
However, because of the delay in updating the picturebox, there is a noticeable delay between the two. The basic code is as follows:
this.pictureBox1.Image = bmp;
this.Invalidate();
OtherFunction();
I have disabled double buffering, and tried all kinds of .Update()
, .Refresh()
, Application.DoEvents()
, but nothing seems to make it any faster.
From my research it seems that setting the Invalidate Flag just means that next time something comes round looking for invalidated forms, it will update it. Is there a way to trigger this manually?
I would rather not introduce a Thread.Sleep()
line unless absolutely necessary