C
Cruithne3753
I'm trying to create a Windows app with a clickable index of images
within a local folder.
Within a loop I've got:-
PictureBox pb = new PictureBox();
pb.Image = Image.FromFile(file);
....
pnlImageIndex.Controls.Add(pb);
Where "file" is the name of each file within a folder. They are all
GIFs, a number of them animated.
With more than 150 images, they all seem to load OK, but after a few
seconds I get this error thrown up:-
System.Runtime.InteropServices.ExternalException: A generic error
occurred in GDI+.
at System.Drawing.Image.SelectActiveFrame(FrameDimension dimension,
Int32 frameIndex)
at System.Drawing.ImageInfo.UpdateFrame()
at System.Drawing.ImageAnimator.UpdateFrames()
at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
at
System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
And images start getting replaced with red outlined boxes with an X.
How do I get round this?
Thanks.
Matt
within a local folder.
Within a loop I've got:-
PictureBox pb = new PictureBox();
pb.Image = Image.FromFile(file);
....
pnlImageIndex.Controls.Add(pb);
Where "file" is the name of each file within a folder. They are all
GIFs, a number of them animated.
With more than 150 images, they all seem to load OK, but after a few
seconds I get this error thrown up:-
System.Runtime.InteropServices.ExternalException: A generic error
occurred in GDI+.
at System.Drawing.Image.SelectActiveFrame(FrameDimension dimension,
Int32 frameIndex)
at System.Drawing.ImageInfo.UpdateFrame()
at System.Drawing.ImageAnimator.UpdateFrames()
at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
at
System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
And images start getting replaced with red outlined boxes with an X.
How do I get round this?
Thanks.
Matt