wxWidgets进度条

客官°小女子只卖身不卖艺 2021-12-16 10:45 593阅读 0赞
  1. #include <wx/wx.h>
  2. #include <wx/progdlg.h>
  3. class myApp : public wxApp {
  4. public:
  5. bool OnInit(void);
  6. int OnExit(void);
  7. };
  8. IMPLEMENT_APP(myApp)
  9. bool myApp :: OnInit(){
  10. int max = 500;
  11. wxFrame* frame = new wxFrame(NULL, wxID_ANY, wxT("blah blah"));
  12. this->SetTopWindow(frame);
  13. frame->Show(true);
  14. wxProgressDialog* dialog = new wxProgressDialog(wxT("Wait..."), wxT("Keep waiting..."), max, frame, wxPD_AUTO_HIDE | wxPD_APP_MODAL );
  15. for(int i = 0; i < max; i++){
  16. wxMilliSleep(10); //here are computations
  17. dialog->Update(i,wxString::Format(wxT("%i"),i),NULL);
  18. }
  19. // dialog->Update(max);
  20. delete dialog;
  21. return true;
  22. }
  23. int myApp :: OnExit(){
  24. return 0;
  25. }

转载于:https://www.cnblogs.com/tiandsp/p/7440788.html

发表评论

表情:
评论列表 (有 0 条评论,593人围观)

还没有评论,来说两句吧...

相关阅读