1.头文件
cpp
#include <wx/notebook.h>
创建notebook
cpp
m_NoteBook =
new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 | wxTAB_TRAVERSAL );
在notebook中添加pannel并
cpp
m_PanelConcatAndZ =
new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerConcatAndZPanel;
bSizerConcatAndZPanel = new wxBoxSizer( wxVERTICAL );
cpp
m_PanelConcatAndZ->SetSizer( bSizerConcatAndZPanel );
m_PanelConcatAndZ->Layout();
bSizerConcatAndZPanel->Fit( m_PanelConcatAndZ );
m_NoteBook->AddPage( m_PanelConcatAndZ, _( "Concat And Z Conversion" ), true );
在该pannel上面的创建控件
cpp
wxStaticText* cztopoloLabel;
cztopoloLabel = new wxStaticText( m_PanelConcatAndZ, wxID_ANY, _( "Topology:" ),
wxDefaultPosition, wxDefaultSize, 0 );
将notebook添加到布局里面
cpp
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND | wxTOP | wxRIGHT | wxLEFT, 10 );
其中bUpperSizer
cpp
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxVERTICAL );
将第一个page设置为默认选择
cpp
// 将第一个page设置为默认选择
notebook->SetSelection(0);
总结
cpp
#include <wx/notebook.h>
#include <wx/panel.h>
wxPanel* m_PanelDispaly =new wxPanel( m_NoteBookTran, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerDisplay = new wxBoxSizer( wxVERTICAL );
m_PanelDispaly->SetSizer( bSizerDisplay );
m_PanelDispaly->Layout();
bSizerDisplay->Fit( m_PanelDispaly );
m_NoteBookTran->AddPage( m_PanelDispaly, _( "Display" ), true );
// 将第一个page设置为默认选择
notebook->SetSelection(0);
bMainSizer->Add( m_NoteBookAC, 1, wxEXPAND, 5 );