I am trying to load images quickly into a picturebox and draw on them. I have a .13 second delay between the time I assign a bitmap to the picture box and when it shows up. And whenever I do a picturebox.refresh(), it is the same delay of .13 - .15 seconds before the paint method is called. Is there any way to get rid of this delay?
I am using C# in Visual Studio 2010. I load the images using FreeImage library.
Here is the code in my pictureBox_MouseMove event:
if (IsMouseDown || DrawLine.Checked || IsMovingBox)
{
Tracing.Trace("Update Picture Box");
pictureBox.Refresh();
}
Then I trace out a line when my paint event is called. The delay is between the two trace lines.
If I use a bitonal tiff image at 117kb the delay is .13 seconds. To load this image into memory takes .04 seconds. To replace my picturebox bitmap with this bitmap takes .01 seconds.
If I use a gray scale jpg image at 1125kb the delay is .14 seconds. To load this image into memory takes .26 seconds. To replace my picturebox bitmap with this bitmap takes .03 seconds.