How to create and use a png resource??? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
idhan
Experienced Solver
Experienced Solver
Posts: 88
Joined: Tue Feb 28, 2006 9:03 pm

How to create and use a png resource???

Post by idhan » Tue Mar 14, 2006 5:47 pm

Hi,

I want to use a png picture in my application and I am using VC++ 2005 Profesional. I can load "xpm" files, using -include file.png- command but I am limited only to 255 colors depth and I need to use a png file as resources in my application. Someone can send me an example how to do that? I dont want load the xpm file in execution time of my application..I want it as part of my exe file.

Thanks.. :-)

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Tue Mar 14, 2006 6:37 pm

I use the method described here which works quite well.

idhan
Experienced Solver
Experienced Solver
Posts: 88
Joined: Tue Feb 28, 2006 9:03 pm

Post by idhan » Tue Mar 14, 2006 8:24 pm

Hi again :-)

Thanks for the link, I have also read:

http://www.wxwidgets.org/manuals/2.4.2/wx478.htm

where it is explained about use wxrc but I dont have any of these directory:

contrib/src/xrc ; XRC source
contrib/include/wx/xrc ; XRC headers
contrib/samples/xrc ; XRC sample
contrib/utils/wxrc ; XRC resource compiler
contrib/utils/wxrcedit ; XRC editor (in progress)

I have install wxwidgets 2.6.2 using the binary install. And I cann't compile this xrc application... any help?

Thanks again...

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Tue Mar 14, 2006 8:48 pm

Hi,

XRC has now been incorporated into the mainstream of wxWidgets, so it isn't in contrib any longer and you don't need to compile it separately.

Try http://www.wxwindows.org/manuals/2.6.2/ ... ource.html instead of the 2.4.2 version.

Regards,

David

idhan
Experienced Solver
Experienced Solver
Posts: 88
Joined: Tue Feb 28, 2006 9:03 pm

Post by idhan » Tue Mar 14, 2006 11:06 pm

Hi David,

Thanks for you explanation. I can understand the class wxXmlResource but how I crate a resource file? not for gui controls for png files?

If you can give me any example step by step for wxwidgets 2.6.2 I will appreciate it.

Another question, I have added the head < wx/mstream.h > into my application but I don't know to which xxx.lib belongs. Who can I know for a single wxXXX.h its wxXXX.lib? Its compile the header but the linker doesn't work because I don't know wich xxx.lib I need.

Thanks... :-)

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Wed Mar 15, 2006 3:33 pm

how I crate a resource file? not for gui controls for png files?
This is from the above link:

Code: Select all

<?xml version="1.0"?>
<resource version="2.3.0.1">

<object class="wxBitmap" name="FIRST_IMG">first.gif</object>
<object class="wxBitmap" name="SECOND_IMG">second.jpg</object>

</resource>
You would presumably do the same thing with *.png

idhan
Experienced Solver
Experienced Solver
Posts: 88
Joined: Tue Feb 28, 2006 9:03 pm

I did it

Post by idhan » Wed Mar 15, 2006 4:18 pm

Thanks..

I found a solution more eficient by embedding png images to C vectors instead of use xrc files and all the clases necessary to handle this type of resources.

thanks for everything, its help me to find the best solution for me.

:-)

Post Reply