Invalid setting for image adjustment

I run the .NET 2.0 program on many computers. On one, I repeatedly repeated this error until I reset the application.

//line below was throwing the exception this.myButton.BackgroundImage = global::myNamespace.Properties.Resources.myImage; 

An exception:

  ExceptionType: ArgumentException Message: Parameter is not valid. Source: System.Drawing StackTrace: at System.Drawing.Image.get_Flags() at System.Windows.Forms.ControlPaint.IsImageTransparent(Image backgroundImage) at System.Windows.Forms.Control.set_BackgroundImageLayout(ImageLayout value) 

The resource exists and it works fine after reset. Can someone give an idea of ​​what might happen?

+5
source share
2 answers

I suggest you use Process Monitor to examine the real-time activity in a file and which processes can block it. Add a filter, where Path is the name of the image / resource file; this should quickly show if something is decapitated with the file behind.

+1
source

Yes, this is a 6 year post! Today I ran into the same error, and it took me a lot longer to fix it than I should. I actually used my image control at startup, so I obviously could not set its background image at runtime. You can also check this twice if you are here.

0
source

All Articles