wxWidgets学习笔记:Tab页wxNotebook使用详解

1.头文件

#include 

创建notebook

m_NoteBook =
            new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 | wxTAB_TRAVERSAL );

在notebook中添加pannel并

m_PanelConcatAndZ =
            new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
 wxBoxSizer* bSizerConcatAndZPanel;
    bSizerConcatAndZPanel = new wxBoxSizer( wxVERTICAL );
 m_PanelConcatAndZ->SetSizer( bSizerConcatAndZPanel );
    m_PanelConcatAndZ->Layout();
    bSizerConcatAndZPanel->Fit( m_PanelConcatAndZ );
    m_NoteBook->AddPage( m_PanelConcatAndZ, _( "Concat And Z Conversion" ), true );

在该pannel上面的创建控件

wxStaticText* cztopoloLabel;
    cztopoloLabel = new wxStaticText( m_PanelConcatAndZ, wxID_ANY, _( "Topology:" ),
                                      wxDefaultPosition, wxDefaultSize, 0 );

将notebook添加到布局里面

 bUpperSizer->Add( m_NoteBook, 1, wxEXPAND | wxTOP | wxRIGHT | wxLEFT, 10 );

其中bUpperSizer

 wxBoxSizer* bUpperSizer;
 bUpperSizer = new wxBoxSizer( wxVERTICAL );

将第一个page设置为默认选择

// 将第一个page设置为默认选择
notebook->SetSelection(0);

总结

#include 
#include 
  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 );

你可能感兴趣的:(wxWidgets,跨平台,GUI,wxWidgets,tab页,wxNotebook,wxPannel)