views:

84

answers:

1

I'm working on a C++ application in Visual Studio (non-MFC) and was surprised to find that I can't add a PNG image to a dialog in the designer which seems a little backward as I can in most other IDEs that I've used. So either a) there is something I'm missing or b) there is a way to do it with code. I'm hoping that it's a but b would be fine.

Any advice suggestions on this?

Thanks, J

+1  A: 

Calling the dialog template editor a "designer" would be rather a stretch. It hasn't changed in the past 15 years or so, neither has the underlying API. An API that doesn't support PNGs, only BMPs. Getting PNG support is possible, GDI+ is available on any Windows version since 2000. But you have to code it yourself.

This is a solved problem, there are excellent class libraries available for UI development, along with tooling to do what you want to do. Qt is one of them if you want to stick with C++.

Hans Passant
Thanks, I thought the IDE looked very familiar to my days of using visual studio 6. I've been using Qt up until now for our application, QtDesigner was one of the IDEs I was referring to as well as Xcode. I'd rather use something I can build into the application rather than relying on a toolkit or external library just to load an image but GDI+ looks promising. I usually write server code so I'm not over familiar with front-end and UI programming. Is there another option I can use that will achieve transparency on parts of the image? I only stated PNG as that's what I have used in the past.
You want a designer you can "build into the application"? That's very unusual. It's possible with Windows Forms.
Hans Passant
I don't want a designer that I can build into the application, I just want to load and display a PNG resource without using a library that I have to distribute with my app.
As I said, GDI+ will be available. Just create your own custom resource, "PNG" is the normal name for the resource type.
Hans Passant
I'm looking at that now and it does seem to be what I need. Thanks.