Checkedlistbox 多列

Checkedlistbox Multicolumn

我在 Windows 表单中有一个 CheckedListBox 控件。

我想知道给谁添加多列。 MultiColumn 属性 设置为真。 我只想知道添加 2 列的编码。

我的密码是

while (true)
{
    data = SDK.GetNext("ACCHISTL", 6);
    document_details = data.Split('|');
    if (document_details[0] == "0")
    {
        if (document_details[3] == Document_nr)
        {
            lbLines.Items.su(document_details[4] + " -> " + document_details[14],true);
        }
        else
        {
            break;
        }
    }
    else
    {
        break;
    }
}

你能帮我看看正确的做法吗?

MultiColumn 属性 设置为 true 不允许您手动添加更多列。一旦项目超过 CheckedListBox 的高度,它只是 'wraps' 项目到下一列而不是显示垂直滚动条。

如果您想要两列控件,请使用某种网格控件或 ListView 控件。通过将 ListView 控件的 View 属性 设置为 View.Details,您可以将其用作多列 'grid'.

虽然 CheckedListBoxMultiColumn 属性 并且您可以将其设置为 true,但它只会排列多列中的项目列表,从上到下然后向右流动项目,基于控制高度

■ 1         ■ 5
■ 2         ■ 6
■ 3         ■ 7
■ 4

因此,如果您确实需要多列,请考虑使用 DatGridViewListView,它们是真正的多列控件。

使用具有所需列数和行数的 TableLayoutPanel,并在其中放置复选框。