Dynamic top list of controls in Windows Forms and C #?

In our SharpWired project , we are trying to create a download component similar to the download windows in Firefox or Safari. That is, one top-down list of downloads, which are customizable controls containing progress bars, buttons, and what not.

The requirements are that there should be one single list with one item on each line. Each item must be a custom control. The whole list should be dynamically re-meaningful, so when you make it longer / shorter, the list adds a scroll bar when necessary, and when you make it thinner / wide, user controls should resize to the width of the list.

We tried using the FlowLayoutPanel but did not get the resize to work the way we want. Preferably, we should set the binding of user controls left and right. We also thought about using TableLayoutPanel , but dynamically added rows to be too much overhead.

This should be a fairly common use case, and it seems a little strange to me that the FlowLayoutPanel has no intuitive way to do this. Has anyone done something similar or do you have tips or tricks?

Hooray!
/Adam

+4
source share
2 answers

If you do not want to use data binding (using the DataRepeater control, as described above), you can use the regular Panel control and set its AutoScroll property to true (to enable scroll bars).

You can then manually add your own controls and set the Dock property for each of them to Top .

+2
source

.NET 3.5 SP1 introduced the DataRepeater Windows Forms control, which sounds like it will do what you want. Bind it to the list of “downloads” (or whatever your list is) and customize each toolbar to include the necessary controls.

+1
source

Source: https://habr.com/ru/post/1276435/


All Articles