如何让 propertygrid 和 sizer 一样大?

How to get the propertygrid as big as sizer?

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

m_propertyGrid1 = new wxPropertyGrid(m_scrolledWindowConstants,wxID_ANY, wxDefaultPosition, wxSize(300, 300), wxPG_DEFAULT_STYLE|wxHSCROLL|wxVSCROLL);
bConstantsSizer->Add( m_propertyGrid1, 0, wxALL, 5 );

我已将 属性 网格的大小硬编码为 300、300,但如何动态地进行编码?

Screenshot_20161221_015600.png

您需要将 proportion 设置为 1 并为其设置 wxEXPAND 标志,请参阅 sizeritemsizeritembase 属性。所以结果应该是

bConstantsSizer->Add( m_propertyGrid1, 1, wxALL|wxEXPAND, 5 );