Jump to content
  • Advertisement
Sign in to follow this  
n8hanson

Bitmap::FromResource() Question

This topic is 4091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is wrong with the following code (Visual C++ Express)? pictureBox1->Image = Bitmap::FromResource(IntPtr.Zero, "MyResourceName"); Program runs, but as soon as it tries to load the resource it quits with this error: "An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll Additional information: Parameter is not valid." What am I doing wrong? What can I do to make this work?

Share this post


Link to post
Share on other sites
Advertisement
Here is the code I'm using to display a picture in a pictureBox control:

pictureBox1->Image = Bitmap::FromResource(IntPtr::Zero, "CH.RES");

CH.RES is the name of a file I added to my resource folder. It was originally a .bmp which I opened in XN Resource Editor and then saved as a resource.

The program runs, but quits with an error as soon as it attempts to load the picture from the resource. Am I using the function call correctly? Is there a problem with my arguments?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!