如何突出显示列表框中显示的那些巨大文件 [英] How to highlight those huge files display in listbox

查看:72
本文介绍了如何突出显示列表框中显示的那些巨大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用c#创建一个窗口应用程序,它将服务器中的所有文件名显示在列表框中。列表框中文件的文件大小有些是字节,KB和MB。

目前,我的目的是通过突出显示文件名来识别那些文件大小(文件大小超过50MB)它显示在列表框中。

我不知道如何编写代码。任何人都可以帮助我,请......?


谢谢。

Hi,
I am using c# to create a window application which display all the file name from the server into a listbox. The file sizes of the files in the listbox some are in Bytes, KB, and MB.
For now, my intention is to identify those file sizes (file sizes which exceed 50MB) by highlighting the file names which display in the listbox.
I have no idea how to write the coding. Anyone can help me, please......?

Thanks.

推荐答案




我正在使用c#创建一个窗口应用程序,它将服务器中的所有文件名显示在列表框中。列表框中文件的文件大小有些是字节,KB和MB。

目前,我的目的是通过突出显示文件名来识别那些文件大小(文件大小超过50MB)它显示在列表框中。

我不知道如何编写代码。任何人都可以帮助我,请......?


谢谢。
Hi,
I am using c# to create a window application which display all the file name from the server into a listbox. The file sizes of the files in the listbox some are in Bytes, KB, and MB.
For now, my intention is to identify those file sizes (file sizes which exceed 50MB) by highlighting the file names which display in the listbox.
I have no idea how to write the coding. Anyone can help me, please......?

Thanks.



我会让ListBox所有者的DrawMode绘制并为ListBox添加一个DrawItem事件。 http中有一个示例://msdn2.microsoft.com/en-us/lib....drawmode.aspx 。您只需将switch语句替换为如果大则使用红色画笔的逻辑。 HTH --Sam

I would make the DrawMode of the ListBox owner draw and add a DrawItem event for the ListBox. There is an example at http://msdn2.microsoft.com/en-us/lib....drawmode.aspx. You would just replace the switch statement with logic that says if big then use the red brush. HTH --Sam


嗨Sam,

对于我现在的愚蠢问题。如何将DrawItem事件添加到列表框? :(

我只设法将DrawMode更改为OwnerDraw。


还有一件我不明白的是如何得到这个:
private void listBox1_DrawItem(object sender,System.Windows.Forms.DrawItemEventArgs e)


当我双击我的UI(列表框)时。它返回:
private void lstFiles_SelectedIndexChanged(object sender,EventArgs e)


我在这方面很新...请耐心等待对我很感激并感谢你的指导。
Hi Sam,
For the dumb question I have now. How to add the DrawItem event to the listbox? :(
I only managed to change the DrawMode to OwnerDraw.

And one more thing that i don''t understand is how to get this:
private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)

When I double-click on my UI (listbox). it returns this:
private void lstFiles_SelectedIndexChanged(object sender, EventArgs e)

I am very new in this area... Please be patient to me and thanks a lot for your guidance.



嗨Sam,

对于我提出的愚蠢问题现在。如何将DrawItem事件添加到列表框?:(

我只设法将DrawMode更改为OwnerDraw。


我还有一件事我不明白如何得到这个:
私有无效listBox1_DrawItem(对象发送者,System.Windows.Forms.DrawItemEventArgs e)


当我双击我的UI(列表框它返回:
私有空lstFiles_SelectedIndexChanged(对象发送者,EventArgs e)


我在这方面很新...请请耐心等待,并感谢你的指导。
Hi Sam,
For the dumb question I have now. How to add the DrawItem event to the listbox? :(
I only managed to change the DrawMode to OwnerDraw.

And one more thing that i don''t understand is how to get this:
private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)

When I double-click on my UI (listbox). it returns this:
private void lstFiles_SelectedIndexChanged(object sender, EventArgs e)

I am very new in this area... Please be patient to me and thanks a lot for your guidance.



没问题,我们会非常慢。

No problem, we''ll go very slow.

  1. 打开一个新的C#Windows应用程序并向表单添加ListBox
  2. 双击表单以生成加载事件。添加一些代码将东西放入ListBox:

展开 | 选择 | Wrap | 行号


这篇关于如何突出显示列表框中显示的那些巨大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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