列表框中每个项目的大小 [英] Size of each item in listbox

查看:103
本文介绍了列表框中每个项目的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在列表框中获取每个项目的大小并显示它.

更新:

我用openfiledialog将文件添加到列表框中.我想获取添加到列表框中的所有文件的大小.

抱歉,第一次没有这么详尽.

I would like to get the size of each item in a list box and display it.

Update:

Im adding files to the listbox with a openfiledialog. I want to get the size of all the files that is added to the listbox.

Sorry for not being this elaborate first time around.

推荐答案

按尺寸,您是指长度吗?如果是这样,则意味着列表框包含字符串的集合.在这种情况下,只需在每个string上使用Length 属性.

[更新]
-----------

回应您的更新问题.在每个路径字符串上使用FileInfo ,然后获取Length 属性.此处的更多信息: http://msdn.microsoft.com/en-us/library/system.io.fileinfo.length.aspx [
By size, do you mean length? And if so that''d mean the listbox contains a collection of strings. In that case, just use the Length property on each string.

[Update]
-----------

In response to your updated question. Use FileInfo on each path-string and then get the Length property. More info here: http://msdn.microsoft.com/en-us/library/system.io.fileinfo.length.aspx[^]


这篇关于列表框中每个项目的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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