Using C++/CLI and Windows Forms, I’m trying to make a simple scrollable list of labelled text controls as a way of displaying some data fields. I’m having trouble making a TableLayoutPanel scrollable – every combination of properties I’ve tried seems to result in some really peculiar side effects.
So I have two questions:
- Is this the best way to do it.
- If it is a reasonable approach, what magic combination of settings should I apply to the table layout panel to make it play ball?
TLP is not designed to be scrollable. You’ll want a FlowLayoutPanel.
Beware that you’ll usually end up with a rather large number of windows which will make your program very slow. Painting becomes noticeably laggy when you get more than about 50 controls in a form. The best solution is a control that can display multiple items but only needs a single Window handle. ListBox, ListView with View = Details, DataGridView are good examples of controls that can do this. They also allow custom painting to tweak their view so you can get it just the way you want it.