Witam tworze aplikacje w środowisku wxDev-C++, przy uzyciu biblioteki wxWidgets. Cel jest taki, żeby w okienku została wyświetlona bitmapa, jednak nie wyświetla się. Oto kod, który napisałem. Jakieś sugestie?
#include"wx/wxprec.h"
#ifndef WX_PRECOMP
#include"wx/wx.h"
#endif
class Aplik : public wxApp
{
public:
virtual bool OnInit();
};
class MyPanel : public wxWindow
{
public:
MyPanel(wxWindow* parent, wxWindowID id = 1, const wxPoint& pos = wxDefaultPosition , const wxSize = wxDefaultSize);
virtual ~MyPanel(){};
};
class Window : public wxFrame
{
public:
Window(const wxString& title, const wxPoint pos, const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
void Rysuj();
private:
MyPanel* MyPanel1;
};
Window::Window(const wxString& title, const wxPoint pos, const wxSize& size, long style)
:wxFrame(NULL, -1, title, pos, size, style)
{
wxInitAllImageHandlers();
MyPanel1 = new MyPanel(this, 2000, wxPoint(0,0), wxSize(400,400));
Rysuj();
}
MyPanel::MyPanel(wxWindow* parent, wxWindowID id , const wxPoint& pos, const wxSize size)
: wxWindow(parent, id, pos, size){}
void Window::Rysuj()
{
wxBitmap Bitmap1(wxT("tło.jpg"), wxBITMAP_TYPE_JPEG);
wxClientDC dc(MyPanel1);
dc.DrawBitmap(Bitmap1, 0, 0, false);
}
IMPLEMENT_APP(Aplik)
bool Aplik::OnInit()
{
Window* MainWindow = new Window(wxT("Mój program"), wxPoint(50,50), wxSize(400,400));
MainWindow -> Show(true);
return true;
}