如何在列表框中排列看起来像列中排列的项目

时间:2014-07-01 05:29:23

标签: asp.net listbox listboxitems ironspeed

说我在asp中的列表框中有我的项目。 (System.Web.UI.WebControls):

100     the lonely guy     123   124
1002      the tiger's den    123   125
10     the master        125   190
10000       the talon's        231    345

我如何安排它,就像它格式化为以下格式的列:

100     the lonely guy     123   124
1002    the tiger's den    123   125
10      the master         125   190
10000   the talon's        231   345


希望我有人能帮助我这个..谢谢。

1 个答案:

答案 0 :(得分:0)

public class Form1 : System.Windows.Forms.Form
{
    private DataSet ds;
    private MultiColumnListBox listBox1;
    public Form1()
    {
        ds = DataArray.ToDataSet(new object[,]{ 
                    {"Row0, col0",  "Row0, col1" ,1},
                    {"Row00, col0", "Row1, col1" ,new object()},
                    {"Row1, col0",  "Row2, col1" ,"Some String"},
                    {"Row1a, col0", "Row3, col1" ,Rectangle.Empty},
                    {"row1aa,col0", "Row4, col1" ,1},
                    {"row0, col0",  "Row5, col1" ,1},
                    {"pow0, col0",  "Row6, col1" ,1}
                    });

        listBox1 = new MultiColumnListBox();
        listBox1.Parent = this;

        listBox1.DataSource = arr;            
    }

}