I met some problems while using GDI+ for drawing different images in my program.
My program represents a window with a button and a background.
Logic of my program intended to work in the following way:
- When user hits the button, an open file dialog box must open and ask
user to select an image file. - When user is done with that, program must draw that file on the background of the main (and single) program window.
My problem is that all Gdiplus objects doesn’t have a default constructors.
So even when I choose FromFile method, my bitmap object still have the same picture, assigned in constructor, so I didn’t even realize how to change them dynamically.
Can you advice some solution to that problem?
The Image::FromFile() method is static, it returns a newly constructed Image object that contains the image. Think of it as a factory method. Without seeing code, I’d have to guess that you forgot to use the return value of the method.