There is such a Widows form enter image description here

It displays data about the user, but it is not so convenient to look at the data about all users, you have to open each user separately

Is there a way to display data like this enter image description here

that is, how many users are in the list as many cards, or at least 50-100 pieces

  • use wpf, or generate code in the code (for example, stick one form into the panel) and then multiply it with the definition parameters. - Vitaly Shebanits
  • You can by more details - Walker
  • There is a DataRepeater element in the VisualBasic Power Packs library. Despite the name, it can be used in C #. - MSDN.WhiteKnight

1 answer 1

  1. All content that now lies on the form is rewritten in the UserControl . In some cases, it is enough to replace the inheritance:
    UserInfo : Form => UserInfo : UserControl .

  2. Add a new empty form. We include the form AutoScroll .

  3. We add FlowLayoutPanel to the form with AutoSize enabled, Location = 0; 0 Location = 0; 0 and ScrollDirection = TopDown . You can turn on the Dock = Fill and AutoScroll = true properties of FLP itself (for a form, in this case, AutoScroll = false ), but if you are going to play with Margin and Padding , then an unpleasant effect will be added to the load. About the nuances of FLP read here . If Margin and Padding not required, feel free to turn on, there will be less problems with scrolling positioning.

  4. After we have received the list of users, for each one, create and fill in UserInfo , which we now have UserControl , and add it to FLP. For example flp.Controls.Add(new UserInfo(UserData)); , naturally having previously added the corresponding constructor in UserInfo .


With long lists, display mapping may be required. It must be remembered that even the simplest Label is a full-fledged window from the WinAPI point of view, with all the overheads, in the form of handles and other unmanaged resources, and if you keep them all in memory all the time, performance problems can arise. But about virtualization is better a separate issue, if you need it.