wxPanel::Fit

void Fit(void)

Resize the panel to just fit around the panel items. Also works for dialog boxes.