防止列表视图项显示在第二列中 [英] Prevent listview items from showing in a second column

查看:26
本文介绍了防止列表视图项显示在第二列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 C# 使用 Winforms.

I am working with Winforms using C#.

用屏幕截图更容易解释我的问题:

It is easier to explain my question with a screen shot:

左侧的列表视图,请注意 items15 及更高版本在第二列中的显示方式.我不想要那个.我希望它有一个垂直滚动条和 items15 出现在 item14 下,等等......不在新列中.我也在列表"上设置了视图"属性.

The list view on the left, notice how items15 and later are showing in a second column. I don't want that. I want it to have a vertical scroll bar and items15 to appear under item14, etc..not in a new column. I have set the "view" property on "List" too.

谢谢大家.

推荐答案

需要设置

listview.Scrollable = true;
listview.View = View.Details
listview.HeaderStyle = ColumnHeaderStyle.None;

添加一个虚拟列,这是一个重要的步骤,因为我们将视图更改为details:

Add a dummy column, its an important step, cause we changed the View to details:

    ColumnHeader header = new ColumnHeader();
    header.Text = "MyHeader";
    header.Name = "MyColumn1";
    listView.Columns.Add(header);

这篇关于防止列表视图项显示在第二列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆