2

我正在使用已选中的ListWiew已选中属性,因此它在第一列中的每个项目上都有一个复选框。现在,我还想在第二列上有另一个复选框,但在我的列表视图的属性中找不到任何有用的复选框,以拥有超过 1 个复选框。

我该怎么做?

4

1 回答 1

4

为什么不使用 DataGrid?它可以根据需要在任何地方显示尽可能多的复选框:)

            dataGridView1.ColumnCount = 3;
            dataGridView1.Columns[0].Name = "Product ID";
            dataGridView1.Columns[1].Name = "Product Name";
            dataGridView1.Columns[2].Name = "Product Price";

            string[] row = new string[] { "1", "Product 1", "1000" };
            dataGridView1.Rows.Add(row);
            row = new string[] { "2", "Product 2", "2000" };
            dataGridView1.Rows.Add(row);
            row = new string[] { "3", "Product 3", "3000" };
            dataGridView1.Rows.Add(row);
            row = new string[] { "4", "Product 4", "4000" };
            dataGridView1.Rows.Add(row);

            DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add(chk);
            chk.HeaderText = "Check Data";
            chk.Name = "chk";
            dataGridView1.Rows[2].Cells[3].Value = true;
于 2011-12-23T17:06:41.467 回答