button images

  • Thread starter Thread starter Stephan Steiner
  • Start date Start date
S

Stephan Steiner

Hi

I have a 16x16 icon that I've set to be an embedded resource. I have also
added the icon as button image for one of my buttons. It compiles just fine,
but when I get the this line in InitializeComponent

this.pauseButton.Image =
((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));

I get an 'System.Resources.MissingManifestResourceException' exception. The
same thing happens if I set the build action of the icon to content.

I have no trouble accessing the icon and assigning it to the bitmap in code,
but why does VS allow me to assign the icon to the image and shows it
properly in the preview, then bombs out with that exception when I try to
run the application? And what can I do to fix that?

Regards
Stephan
 
Stephan Steiner said:
I have a 16x16 icon that I've set to be an embedded resource. I have also
added the icon as button image for one of my buttons. It compiles just
fine, but when I get the this line in InitializeComponent

this.pauseButton.Image =
((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));

I get an 'System.Resources.MissingManifestResourceException' exception.
The same thing happens if I set the build action of the icon to content.

Are you using a manifest file with "devenv.exe" to enable visual styles
inside the IDE? If this is the case delete the manifest file and recreate
the form.
 
Back
Top