Sign in to follow this  

Bitmap::FromResource() Question

This topic is 3876 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
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

This topic is 3876 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this