PictureBox Exception

Jan 5 2005 9:00 AM
I have a rather complex project in C# - that contains, among others, a Panel on which I have a number of objects of the same UserControl Type. The UserControl contains 4 PictureBoxes on it. Each PictureBox has an image associated to it, from the resources.. Sometimes, very rarely, but it happens, I get the following error: System.ArgumentException: Invalid parameter used. at System.Drawing.Image.get_Width() at System.Drawing.Image.get_Size() at System.Windows.Forms.PictureBox.GetPreferredSize() at System.Windows.Forms.PictureBox.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) at System.Windows.Forms.LayoutManager.LayoutDockedControls(Control container, LayoutEventArgs levent) at System.Windows.Forms.LayoutManager.OnLayout(Control container, LayoutEventArgs levent) at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.Control.PerformLayout(Control affectedControl, String affectedProperty) at System.Windows.Forms.Control.PerformLayout() at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e) at System.Windows.Forms.Control.WmShowWindow(Message& m) I am not quite sure, but I think I ususally obtain this error when scrolling the panel on which the user controls are situated. The error, as I've said, happens only very seldom. I can't provide the code, since it is very large. Any help would be greatly appreciatedly - maybe someone got into the same problem.