Search code examples
c#winformscontrolsscrollbarsui-design

How can I add a bunch of labels to a C# form and then scroll the form vertically?


I have a form in C# (WinForm). It looks like this:


(LOGO)

blank space for labels that I add through code (I can fit 10 labels in this space)

(close button)


The blank space can hold about 10 labels.

I am stumped on how I would make this form scrollable if I want to add 20 labels? If I add 20 labels via code, then the 11th label will overlap with my close button and the 12th+ label(s) will run off the end of the form.

How do I make just the blank space portion of my form scrollable where I am creating the labels? I don't want to use a listbox.

Thanks.


Solution

  • Place all controls inside a panel and use scrollbar control.

    Understand .NET Scrollbars