2014年10月26日 星期日

Autosize in wxWidgets with wxDev-C++

If you want the app to change it's layout when window is maximal, you must use sizers. There are many sizers in wxWidgets, such as wxBoxSizer, wxGridSizer and wxFlexGridSizer.

When I have two vertical parts in window and I want the bottom part is fixed size, I can use wxBoxSizer and put two panels on wxBoxSizer. Here is settings about these components.

wxBoxSizer:
Orientation is wxVertical.

wxPanel1(top):
wxALIGN_TOP is true.
wxEXPAND is true.
Stretch Factor is 1.

wxPanel2(bottom):
wxALIGN_BOTTOM is true.
wxEXPAND is true.

If you set Stretch Factor, the part will be adjusted size when window is maximal.


沒有留言:

張貼留言