MPIon
Well-known member
This is a long shot, but might as well post in case someone has an answer to this.
I have 25 picture boxes on my form that are populated with thumbnails of images. I can scroll up and down using the mouse wheel, which repopulates the 25 boxes with a new set of images.
This normally works ok, but very occasionally, I get a System.Argument.Exception on one of the images. This seems to only happen if I scroll up and down quite fast.
It does not seem to be related to the file itself, as rerunning the program will show the thumbnail correctly.
The code to get the thumbnail is :-
The error is :-
Putting a try block around the code does not help as it refuses to catch the error.
This is the stack trace if of any use :-
I am wondering if it is a timing issue in extracting the thumbnail from the cache?
I have 25 picture boxes on my form that are populated with thumbnails of images. I can scroll up and down using the mouse wheel, which repopulates the 25 boxes with a new set of images.
This normally works ok, but very occasionally, I get a System.Argument.Exception on one of the images. This seems to only happen if I scroll up and down quite fast.
It does not seem to be related to the file itself, as rerunning the program will show the thumbnail correctly.
The code to get the thumbnail is :-
C#:
boxData[boxNo].pictureBox.Image = shellFile.Thumbnail.LargeBitmap;
Putting a try block around the code does not help as it refuses to catch the error.
This is the stack trace if of any use :-
C#:
System.ArgumentException
HResult=0x80070057
Message=Parameter is not valid.
Source=System.Drawing.Common
StackTrace:
at System.Drawing.Image.get_Width()
at System.Drawing.Image.get_Size()
at System.Windows.Forms.PictureBox.ImageRectangleFromSizeMode(PictureBoxSizeMode mode)
at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
I am wondering if it is a timing issue in extracting the thumbnail from the cache?