c++widgetwxwidgets

How to add picture in wxWidget's frame?


I am very new to wxWidget. I want to create a frame which display some text and a picture. I had tried to search on internet/wsWidget help but I couldn't able to find the solution. I know there are some image hander like wxPNGHandler(); but I don't know how to use it. Any simple code to display the image will be very useful.

    class MyFrame : public wxFrame
    {
public:
     MyFrame();
    }

MyFrame :: MyFrame() : wxFrame( NULL, wxID_ANY, wxT( "My wxWidget" ), wxDefaultPosition, wxSize( 290, 180 ), wxCAPTION |  wxCLOSE_BOX)
{
  wxPanel *panel = new wxPanel(this, wxID_ANY);
  wxString  text = wxT("Text Display\n");
//Add image to display
}

Solution

  • After trying for a day, finally this one worked.

    wxPNGHandler *handler = new wxPNGHandler;
    wxImage::AddHandler(handler);
    wxStaticBitmap *image;
    image = new wxStaticBitmap( this, wxID_ANY, wxBitmap("Windows_7_logo.png", wxBITMAP_TYPE_PNG), wxPoint(50,100), wxSize(100, 500));