我是 wxWidgets 的新手,因为我在用 C++ 编程时从不使用 GUI。现在我必须这样做。我想使用DockStyle.Right/Bottom/FillWinForms 之类的东西使 UI 响应。由于我之前没有尝试过代码,所以问题很短,也不是最好的,但我希望有人能帮助我。
编辑: 这就是我目前拥有的。当我取消注释 SetMaxSize 时,底部有 30px 的空间,但面板(蓝色)不可见:
namespace tms {
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame(NULL, wxID_ANY, title, pos, size) {
this->InitialiseComponents();
}
void MainFrame::InitialiseComponents() {
this->panelChatLog = new wxPanel(this, wxID_ANY);
this->panelChatLog->SetBackgroundColour(wxColour(0, 255, 0));
this->panelChatInput = new wxPanel(this, wxID_ANY);
this->panelChatInput->SetBackgroundColour(wxColour(0, 0, 255));
this->panelChatInput->SetMinSize(wxSize(0, 30));
//this->panelChatInput->SetMaxSize(wxSize(0, 30));
this->sizerPanels = new wxBoxSizer(wxVERTICAL);
this->sizerPanels->Add(this->panelChatLog, 1, wxEXPAND | wxALL);
this->sizerPanels->Add(this->panelChatInput, 1, wxEXPAND | wxALL);
this->SetSizer(this->sizerPanels);
}
void MainFrame::OnExit(wxCommandEvent& event) {
this->Close(true);
}
}
