Multi Column Listbox

梦想与她 提交于 2020-01-15 03:57:22

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/242320/multi-column-listbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!