I’m writing a Windows application.
In the form I have a Panel and inside the panel I have a PictureBox control.
I’m loading the PictureBox control with BMP image that has the following
criteria:
14174 x 7874 Pixels (111.61MPixels), 1 BitsPerPixel, 3200x3200 DPI, No
Compression.
The memory consumption for loading this image should be 13.31 MB (13,952,776
Bytes) (this is what IrfanView takes, http://www.irfanview.com/).
I’m loading the BMP file like that:
pictureBox1.Image = Image.FromFile("MyFileName.bmp", true);
// - or -
//pictureBox1.Image = Image.FromFile("MyFileName.bmp");
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Width = pictureBox1.Image.Width;
pictureBox1.Height = pictureBox1.Image.Height;
And this way, I get image scrolling for free (see
http://www.codeproject.com/cs/miscctrl/PictureBox.asp).
After I load the image, the memory usage of my application is about 50 MB
according to the Windows ‘Task Manager’.
The trouble is that every time I try to move any scroll bar, or showing the
image after hiding it (or part of it) with another window, it redraws itself
very very slowly and the memory usage jump up to 430 MB for a few seconds.
I’m running this application on a Pentium 4 processor 2.4GHz and 1.5 GB RAM.
Can anybody tell me why this is happening and how can I make it run much
much faster with no memory eating?
--------
Thanks
Sharon