Multi Column Listbox

2019-07-15 10:52发布

Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview.

Thanks

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-07-15 11:32

You could bind a list to a listbox like this:

List<int> list = new List<int> { 1, 2, 4, 8, 16 };
listBox1.DataSource = list;

As for multicolumn listbox documentation says ListBox.MultiColumn only places items into as many columns as are needed to make vertical scrolling unnecessary.

If you want to show several columns of information for which an entire row will get selected you could use Multi Column List Box by Chris Rickard.

查看更多
疯言疯语
3楼-- · 2019-07-15 11:40

For .NET 2.0 you can use the UseCustomTabOffsets and CustomTabOffsets, if you need multi-column support in your ListBox. See how to make more than 2 column's in ListBox using C#? for an example of use.

查看更多
登录 后发表回答