Sign in to follow this  
n8hanson

Bitmap::FromResource() Question

Recommended Posts

n8hanson    126
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
n8hanson    126
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

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