如何在详细信息视图中向列表视图添加图像和文本 [英] how to add images and text to a listview in details view

查看:86
本文介绍了如何在详细信息视图中向列表视图添加图像和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此列表视图,因此我在存储在图像列表中的图像之前添加了带有图像的消息.以下是我将文本和图像添加到列表视图的方法:

ListView1.Items.Add(这是一个测试",0)

上面的代码工作正常,但是当我添加5个以上的项目时,当我希望这些项目获得垂直滚动条时,我便开始获得水平滚动条.如果我仅使用文本,则详细信息视图工作正常,但是当我尝试在详细信息视图中使用以上代码时,它将添加没有文本或图像的空白行.

解决方案

我想出了我的问题.我必须添加一列,然后所有内容才开始在dtails视图中显示.之所以会得到水平条形,是因为垂直滚动条将列表视图的可显示区域缩小了.扩大控件范围.


Im working on this list view that i added messages to with a image right before it that is stored in an image list. below is how i add the text and the image to the listview:

ListView1.Items.Add("This is a test", 0)

the above code works fine but when i add more then 5 items i start getting the horizontal scroll bar when i want these items to get the vertical scroll bar. If i use just text the details view works just fine but when i try to use the above code in details view it adds a blank line with no text or image. if someone could help and point me in the right direction for this that would be great.

解决方案

I figured out my issue. I had to add a column and everything started showing up in the dtails view.


It appears as though you didn''t account for the width of the vertical scroll bar. You get the horizontal bar because the displayable area of your listview is being cut down by the vertical scroll bar. Make the control wider.


这篇关于如何在详细信息视图中向列表视图添加图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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