How should I make the border be automatically resized as the comboboxes in a dropdown menu are expanded or shrunk?

I wanna to make it the goal that the border could be automatically resized(shrunk and expanded) as I choose expand a menu which contains comboboxes. How should I do it?