当前位置: 代码迷 >> 综合 >> widgets menus
  详细解决方案

widgets menus

热度:78   发布时间:2024-01-25 21:41:00.0

带有图片的toolbar

wxImage::AddHandler(new wxPNGHandler);
// 增加图片 exit.png
wxBitmap exit(wxT("exit.png"), wxBITMAP_TYPE_PNG);// wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
wxToolBar *toolbar = CreateToolBar();toolbar->AddTool(wxID_EXIT, wxT("Exit application"), exit);// 实现
toolbar->Realize();Connect(wxID_EXIT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(Toolbar::OnQuit));

menubar增加menu

  menubar = new wxMenuBar;file = new wxMenu;file->Append(wxID_EXIT, wxT("&Quit"));// 增加分割线file->AppendSeparator();// file->AppendSubMenu(wxMenu, wxT("&Import"));// file->Append(wxMenuItem);menubar->Append(file, wxT("&File"));SetMenuBar(menubar);Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(SimpleMenu::OnQuit));
  相关解决方案