level 6
各位大神 谁有没有加载图片的小程序wxwidgets的
分享一下
刚开始接触wxwidgets
正在做象棋
选择了wxwidgets做界面
图片一直加载不出来
不知道怎么回事,看了一些wxwidgets自带的例子
也不知道哪错了
谢谢
2016年05月25日 05点05分
1
level 7
#include "wx/wx.h"
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
class Dialog : public wxDialog
{
public:
Dialog(const wxString& title);
private:
wxStaticBitmap* m_bitmap;
void OnClose(wxCloseEvent& event);
DECLARE_EVENT_TABLE()
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
wxInitAllImageHandlers();
Dialog* dialog = new Dialog("Sample");
dialog->Center();
dialog->Show(true);
return true;
}
BEGIN_EVENT_TABLE(Dialog, wxDialog)
EVT_CLOSE(Dialog::OnClose)
END_EVENT_TABLE()
Dialog::Dialog(const wxString& title)
: wxDialog(NULL, wxID_ANY, title)
{
wxBitmap bitmap = wxImage("Pic.png");
m_bitmap = new wxStaticBitmap( this,-1,bitmap );
}
void Dialog::OnClose(wxCloseEvent &event)
{
Destroy();
}
最简单的了~
2016年05月25日 12点05分
2