2010-02-24 71 views
1

我想在窗口或面板中創建3個零件。所有3部分應該有可能由用戶調整大小,並在用戶更改主窗口大小時自動調整大小。它的東西就像3個面板添加到垂直盒尺寸大小,但用戶可以調整所有三個部分。我可以將最多2個面板添加到wxSplitterWindow。如何在wxWidgets中製作'3部分'拆分器窗口?

我正在使用C++,wxWidgets和wxFormBuilder。

回答

4

您可以使用http://docs.wxwidgets.org/stable/wx_wxauimanager.html'>wxAuiManager? 你可以使用它來創建'面板'(缺少一個更好的詞),可以調整大小和移動。 (即使脫開並漂浮)。對你而言,它看起來像這樣:

wxAuiManager * pManager; // a pointer to the manager for the wxFrame 
wxWindow * pPanel1; 
wxWindow * pPanel2; // the 3 panels you want to add 
wxWindow * pPanel3; // they can be wxPanel's or any window 

// Add the panels to the window 
pManager->AddPane(pPanel1,wxAuiPaneInfo().Top()); 
pManager->AddPane(pPanel2,wxAuiPaneInfo().Centre()); 
pManager->AddPane(pPanel3,wxAuiPaneInfo().Bottom()); 

希望這對你有效。

+0

我會看看這個,謝謝。 – Piniu 2010-02-25 09:30:38

+0

@Piniu:如果能解決您的問題,請接受答案。否則,請解釋什麼是不工作。 – 2010-03-02 04:00:13

0

enter image description here

上面的鏈接是我的人才流動chart.I使用SplitterWindow內2 SplitterWindow的屏幕截圖。

下面的鏈接是我的輸出窗口的屏幕截圖。 enter image description here

這是代碼塊12.11使用wxWidgets的2.8.12基於Windows的應用程序框架。

AppWindow = new wxBoxSizer(wxVERTICAL); 

AppWindow->Add(AppRibbonPane, 0, wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP, 0);

AppMainPane = new wxBoxSizer(wxVERTICAL);

AppMiddlePane = new wxSplitterWindow(this, ID_SPLITTERWINDOW1, wxPoint(0,20), wxSize(800,580), wxSP_3D, _T("ID_SPLITTERWINDOW1"));

AppMiddlePane->SetMinSize(wxSize(20,20));

AppMiddlePane->SetMaxSize(wxSize(-1,-1));

AppMiddlePane->SetToolTip(_("Work Area"));

AppMiddlePane->SetMinimumPaneSize(20);

AppMiddlePane->SetSashGravity(0);

SplitterWindow1 = new wxSplitterWindow(AppMiddlePane, ID_SPLITTERWINDOW2, wxPoint(0,0), wxSize(200,580), wxSP_3D, _T("ID_SPLITTERWINDOW2"));

SplitterWindow1->SetMinSize(wxSize(10,10));

SplitterWindow1->SetMaxSize(wxSize(-1,-1));

SplitterWindow1->SetMinimumPaneSize(10);

SplitterWindow1->SetSashGravity(0);

AuiNotebook1 = new wxAuiNotebook(SplitterWindow1, ID_AUINOTEBOOK1, wxPoint(0,0), wxSize(200,290), wxAUI_NB_DEFAULT_STYLE|wxDOUBLE_BORDER);

AuiNotebook1->SetMinSize(wxSize(-1,40));

AuiNotebook1->SetMaxSize(wxSize(800,580));

ListCtrl1 = new wxListCtrl(AuiNotebook1, ID_LISTCTRL1, wxDefaultPosition, wxSize(200,290), wxLC_SMALL_ICON|wxLC_ALIGN_LEFT|wxLC_AUTOARRANGE|wxLC_SINGLE_SEL, wxDefaultValidator, _T("ID_LISTCTRL1"));

ListCtrl1->SetMinSize(wxSize(-1,40));

ListCtrl1->SetBackgroundColour(wxColour(240,255,210));

ListCtrl2 = new wxListCtrl(AuiNotebook1, ID_LISTCTRL2, wxDefaultPosition, wxSize(200,290), wxLC_SMALL_ICON|wxLC_ALIGN_LEFT|wxLC_AUTOARRANGE, wxDefaultValidator, _T("ID_LISTCTRL2"));

ListCtrl2->SetMinSize(wxSize(-1,40));

ListCtrl2->SetBackgroundColour(wxColour(240,255,210));

`AuiNotebook1-> AddPage(ListCtrl1,_( 「設備」),假

wxBitmap(wxImage(_T(「C:\項目\ Matesnap \ Logo \ MateSnap logo 22x19.jpg「)))); `

`AuiNotebook1-> AddPage(ListCtrl2,_( 「宏」),假

wxBitmap(wxImage(_T(「C:\項目\ Matesnap \標誌\ MateSnap標誌22x19。JPG「))));`

SplitterWindow2 = new wxSplitterWindow(SplitterWindow1, ID_SPLITTERWINDOW3, wxPoint(0,0), wxSize(200,290), wxSP_3D, _T("ID_SPLITTERWINDOW3"));

SplitterWindow2->SetMinSize(wxSize(10,10));

SplitterWindow2->SetMinimumPaneSize(10);

SplitterWindow2->SetSashGravity(0);

StaticText1 = new wxStaticText(SplitterWindow2, ID_STATICTEXT1, _("Actions"), wxPoint(0,0), wxSize(200,20), wxALIGN_CENTRE|wxDOUBLE_BORDER, _T("ID_STATICTEXT1"));

StaticText1->SetBackgroundColour(wxColour(240,255,210));

ListCtrl3 = new wxListCtrl(SplitterWindow2, ID_LISTCTRL3, wxPoint(0,20), wxSize(200,270), wxLC_SMALL_ICON|wxLC_ALIGN_LEFT|wxLC_AUTOARRANGE, wxDefaultValidator, _T("ID_LISTCTRL3"));

ListCtrl3->SetBackgroundColour(wxColour(240,255,210));

請看看它,即使你得到了解決,因爲它可能會在你未來的projects.It可能會幫助你很多有用的。