ListView控件和详细信息 [英] ListView Control and Details

查看:256
本文介绍了ListView控件和详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是有点,我看了一下ListView的一些教程相混淆。

I'm a bit confused by a few tutorials that I read about the ListView.

我有一个ListView控件和左侧应该是一个名称,该名称的权利应该是这样的,在它的一些更多的文本另一列。例如:

I have a ListView control and on the left hand side should be a name, and to the right of that name should be like another column with some more text in it. For example:

jason     blah blah blah  
item2     more blahs  
item3     jupiter  
item4     uranus  

如何才能做到这一点?是否有这样做的一个简单的方法?

How can this be done? Is there a simple way of doing this?

感谢您

推荐答案

使用的列标头集合添加列,如

Use the Columns header collection to add the columns such as

  • 在列#1
  • 在列#2
  • 在列#3

然后使用一个ListViewItem的集合设置列的值,这个

then use the ListViewItem's collection to set the values of the columns such this


ListViewItem lvi = new ListViewItem("foo");
lvi.Add("bar");
lvi.Add("baz");
listview.Items.Add(lvi);

现在,您将有福,酒吧和巴兹分别在列列#1,列2和列#3分别。

Now, you will have "foo", "bar" and "baz" respectively under the columns "Column #1", "Column #2" and "Column #3" respectively.

您会发现列集合从属性工具框的列表视图中。请确保你设置视图类型详细信息看到这种效果。

You will find the Column collection from within the Properties tool box for the listview. Be sure you set the view type to 'Details' to see this effect.

这篇关于ListView控件和详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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