开发者

Grouping Controls in Pairs vb.net windows.forms - Dynamic List in grid format

开发者 https://www.devze.com 2023-01-15 23:10 出处:网络
I have pairs of controls: immagebox + textbox = one pair. I want these to show up in a single column grid/tabular format.Each cell contains one image/text pair.

I have pairs of controls: immagebox + textbox = one pair.

I want these to show up in a single column grid/tabular format. Each cell contains one image/text pair.

I want this grid to scroll because the number of pairs is dynamic depending on a user selection.

I suppose I will be adding these controls in code at runtime when th开发者_运维知识库e user makes his/her selection.

What is the best way to accomplish that in vb.net? TableLayoutPanel or better way?


One possible approach is the following.

Use a Panel as your container. Inside this Panel you can add a TableLayoutPanel that is defined to be AutoSize=True. Add two columns to your table layout and then add controls in rows as needed. The TableLayoutPanel will then size itself automaticlly depending on the contents.

Now make your Panel be AutoScroll=True and it will automatically add the correct scrollbars so the user can move around and see the contained set of controls.

0

精彩评论

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