delegate void AddListViewItemsCallBack(ListViewItem[] lvis);
private void addListViewItem(ListViewItem[] lvis)
{
if (listView1.InvokeRequired)
{
AddListViewItemsCallBack d = new AddListViewItemsCallBack(addListViewItem);
this.Invoke(d, new object[] { lvis });
}
else
{
listView1.Items.AddRange(lvis);
}
}
private void clearfile(object pp)
{
Parameter p = (Parameter)pp;
string pathvariable=p.Path;
string fileexpand=p.SearchPattern;
string filetype=p.FileType;
string pathadd = p.PathAdd;
//如果小的目录,不用多线程,注意下面的改动,不把listView.Refresh()放在循环中即可消除闪烁。
string path = Environment.GetEnvironmentVariable(pathvariable) + pathadd;
string[] pathfiles = Directory.GetFiles(path, fileexpand, SearchOption.AllDirectories);
ListViewItem[] lvis = new ListViewItem[pathfiles.Length];
if ((pathfiles.Length) > 0)
{
int i = 0;
foreach (string filedir in pathfiles)
{
string filename = filedir.Substring(filedir.LastIndexOf("\\") + 1);
FileInfo filelg = new FileInfo(filedir);
string filelength = (filelg.Length / 1024).ToString();
if (filelength == "0") filelength = "1";
ListViewItem objListItem = new ListViewItem(filetype);
objListItem.SubItems.Add(filename);
objListItem.SubItems.Add(filelength);
objListItem.SubItems.Add(filedir);
objListItem.EnsureVisible();
lvis[i++]=objListItem;
}
}
addListViewItem(lvis);
//若不使用多线程,调用此句listView1.Items.AddRange(lvis);
}
private void button1_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
Thread th =new Thread(new ParameterizedThreadStart(this.clearfile));
Parameter p=new Parameter();
p.Path="temp";
p.SearchPattern="*.*";
p.FileType="临时文件";
p.PathAdd="";
th.Start(p);
}
没有合适的资源?快使用搜索试试~ 我知道了~
C# 系统垃圾扫描程序
共49个文件
cs:7个
application:6个
manifest:6个
5星 · 超过95%的资源 需积分: 10 16 下载量 114 浏览量
2008-09-12
15:52:56
上传
评论
收藏 370KB RAR 举报
温馨提示
解决了LISTVIEW刷新时闪烁的问题,只写了几个位置的扫描,大家可以自己添加!
资源推荐
资源详情
资源评论
收起资源包目录
scan.rar (49个子文件)
scan
scan.sln 905B
scan
Form1.cs 8KB
bin
Debug
IrisSkin2.dll 504KB
scan.pdb 32KB
scan.vshost.application 1KB
DiamondBlue.ssk 16KB
scan.application 1KB
DeepGreen.ssk 5KB
scan.exe 24KB
scan.exe.manifest 3KB
scan.vshost.exe.manifest 3KB
scan.vshost.exe 6KB
Release
scan.pdb 22KB
scan.application 1KB
scan.publish
scan_1_0_0_1
scan.exe.deploy 20KB
scan.exe.manifest 6KB
scan.application 5KB
setup.exe 414KB
scan.exe 20KB
scan.exe.manifest 2KB
scan.csproj 5KB
obj
Debug
scan.csproj.GenerateResource.Cache 842B
scan.Properties.Resources.resources 180B
scan.pdb 32KB
scan.application 1KB
ResolveAssemblyReference.cache 6KB
scan.Form1.resources 180B
scan.exe 24KB
Refactor
scan.exe.manifest 3KB
TempPE
Release
scan.csproj.GenerateResource.Cache 842B
scan.Properties.Resources.resources 180B
scan.pdb 22KB
scan.application 1KB
scan.Form1.resources 180B
scan.exe 20KB
scan.exe.manifest 2KB
TempPE
scan.csproj.FileList.txt 771B
Properties
Resources.Designer.cs 3KB
Settings.settings 249B
Resources.resx 5KB
Settings.Designer.cs 1KB
AssemblyInfo.cs 1KB
Program.cs 463B
DoubleBufferListView.cs 441B
scan.csproj.user 580B
Form1.Designer.cs 6KB
Form1.resx 6KB
help.txt 2KB
scan.suo 19KB
共 49 条
- 1
资源评论
- 12595649362013-04-26略显复杂,代码值得研究研究
- qnlyphqy2013-05-19这个程序好棒 就是点击清理垃圾时候没有什么反映 而且那个listbox有些闪烁 最好重写重绘窗体的函数
- ndnnzhf2016-09-01代码写的不错啊
q5331006
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 常用工具集参考用于图像等数据处理
- 音乐展示网页、基于Stenography的图像数字水印添加与提取,以及基于颜色矩和Tamura算法的图像相似度评估算法py源码
- 基于EmguCV(OpenCV .net封装),图像数字水印加解密算法的实现,其中包含最低有效位算法,离散傅里叶变换算法+文档书
- 基于matlab+DWT的图像水印项目,数字水印+源代码+文档说明+图片+报告pdf
- (优秀毕业设计)基于python实现的数字图像可视化水印系统的设计与实现,多种数字算法实现+源代码+文档说明+理论演示pdf
- 基于DWT-DCT-SVD和deflate压缩的数字水印方法python源码+Gui界面+演示视频(高分毕业设计)
- 基于matlab实现DWT、DCT、SVD算法数字图像水印可视化系统+GUI界面+文档说明+详细注释(高分毕业设计)
- NCIAE-Data-Structure大一大二笔记
- 学习wireshark笔记
- digital-image-数据可视化笔记
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功