Reputation: 1206
I'm trying to append multiple UserControls to my WinForm Panel.
At first, the Controls.Add() function was adding the UserControls one above the other. But then I figured out that I need to use Dock property. I've changed the Dock property of the UserControl to DockStyle.Left and this is what I've got:
But when I tried to add another UserControl this is what I've got:
The added UserControl leaked out of the panel.
I want the new UserControl to be appended in the new line if there not enough space for the previous line to contain the UserControl.
I would expect to see something like that:
How can I achieve the desired result?
Upvotes: 2
Views: 3977
Reputation: 1206
Thanks to @IvanStoev I solved the problem.
What I needed to do is to change my Panel to FlowLayoutPanel. FlowLayoutPanel arranges himself the appended UserControls.
Upvotes: 2