Im trying to create toolBar. I added resource file to the Visual Studio project, then added to that resource png file.
Now the question is how to use 开发者_StackOverflow社区it as a icon for the button?
this is my code: wxBitmap exit(wxT("cross.png"));
and when I run application I have error:
Cant load "cross.png" bitmap from resource. Please check .rc file
thanks for help
First you need to make sure you use the actual name of the resource as defined in your RC file (maybe just "cross" instead of "cross.png", as the error states - check your RC file). Second, you'll also need to make sure you have initialized all image handlers if you haven't already (just call wxInitAllImageHandlers()). Third, you'll need to specify the image format type when you call the wxBitmap constructor, for example:
wxBitmap exit(wxT("cross"), wxBITMAP_TYPE_PNG);
精彩评论