开发者

What's the simplest way to make a scrollable list of controls with labels?

开发者 https://www.devze.com 2023-01-01 03:47 出处:网络
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 scrollabl

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:

  1. Is this the bes开发者_运维知识库t way to do it.
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消