我wxFormbuilder創建這個簡單的wxWidgets應用:絲帶菜單空白處
正如你所看到的,有色帶上的菜單選項卡的奇怪的空白。有什麼我失蹤?如果讓功能區菜單直接排列在左上方,將會更好。如果有人需要它,這裏是wxFormbuilder生成的代碼:
this->SetSizeHints(wxSize(183,146), wxDefaultSize);
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer(wxVERTICAL);
m_ribbonBar1 = new wxRibbonBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRIBBON_BAR_DEFAULT_STYLE);
m_ribbonBar1->SetArtProvider(new wxRibbonAUIArtProvider);
m_ribbonPage1 = new wxRibbonPage(m_ribbonBar1, wxID_ANY, wxT("File") , wxNullBitmap , 0);
m_ribbonBar1->SetActivePage(m_ribbonPage1);
m_ribbonPanel1 = new wxRibbonPanel(m_ribbonPage1, wxID_ANY, wxT("File") , wxNullBitmap , wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE);
m_rbtnBar = new wxRibbonButtonBar(m_ribbonPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
m_rbtnBar->AddButton(wxID_ANY, wxT("New"), wxNullBitmap, wxEmptyString);
m_rbtnBar->AddButton(wxID_ANY, wxT("Save"), wxNullBitmap, wxEmptyString);
m_rbtnBar->AddButton(wxID_ANY, wxT("Load"), wxNullBitmap, wxEmptyString);
m_ribbonPage2 = new wxRibbonPage(m_ribbonBar1, wxID_ANY, wxT("View") , wxNullBitmap , 0);
m_ribbonBar1->SetActivePage(m_ribbonPage2);
m_ribbonPanel21 = new wxRibbonPanel(m_ribbonPage2, wxID_ANY, wxT("View") , wxNullBitmap , wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE);
m_ribbonButtonBar21 = new wxRibbonButtonBar(m_ribbonPanel21, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
m_ribbonButtonBar21->AddButton(wxID_ANY, wxT("Do something"), wxNullBitmap, wxEmptyString);
m_ribbonButtonBar21->AddButton(wxID_ANY, wxT("Do something else"), wxNullBitmap, wxEmptyString);
m_ribbonBar1->Realize();
bSizer4->Add(m_ribbonBar1, 0, wxEXPAND, 5);
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer(wxVERTICAL);
m_ntbkMain = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
m_panel1 = new wxPanel(m_ntbkMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer(wxVERTICAL);
m_button11 = new wxButton(m_panel1, wxID_ANY, wxT("MyButton"), wxDefaultPosition, wxDefaultSize, 0);
bSizer7->Add(m_button11, 0, wxALL, 5);
m_button12 = new wxButton(m_panel1, wxID_ANY, wxT("MyButton"), wxDefaultPosition, wxDefaultSize, 0);
bSizer7->Add(m_button12, 0, wxALL, 5);
m_button13 = new wxButton(m_panel1, wxID_ANY, wxT("MyButton"), wxDefaultPosition, wxDefaultSize, 0);
bSizer7->Add(m_button13, 0, wxALL, 5);
bSizer6->Add(bSizer7, 1, wxEXPAND, 5);
m_panel1->SetSizer(bSizer6);
m_panel1->Layout();
bSizer6->Fit(m_panel1);
m_ntbkMain->AddPage(m_panel1, wxT("Tab 1"), true);
m_panel2 = new wxPanel(m_ntbkMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_ntbkMain->AddPage(m_panel2, wxT("a page"), false);
m_panel3 = new wxPanel(m_ntbkMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_ntbkMain->AddPage(m_panel3, wxT("a page"), false);
m_panel4 = new wxPanel(m_ntbkMain, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_ntbkMain->AddPage(m_panel4, wxT("a page"), false);
mainSizer->Add(m_ntbkMain, 1, wxEXPAND, 5);
bSizer4->Add(mainSizer, 1, wxEXPAND, 5);
this->SetSizer(bSizer4);
this->Layout();
this->Centre(wxBOTH);
什麼你是WX和Windows版本?你能在樣本中重現嗎? – Igor
@Igor Windows 10教育版64位,源自wxWidgets 3.1.0。我還沒有嘗試過,這只是它在wxFormbuilder設計器中的樣子。 – calcyss
試試這個例子。如果有效,請查看與您的代碼有什麼不同。如果沒有 - 那麼,發佈到wx-dev或在trac.wxwidgets.org上打開一張票。另外,嘗試實際編譯的應用程序二進制文件 - 有時RAD工具可能會引起誤解。 – Igor