------解决方案--------------------
多线程写起来比较复杂啊,我把代码贴到这里给你吧。不知道你能不能看明白;有点长,我使用它来搜索文件的注释狠详细 --------------------------frmSerach.cs--------------------------- using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; using System.Collections; using System.Text.RegularExpressions; using System.IO;
namespace MyUdisk { public partial class frmSerach : Form { private CThreadSearch m_objThreadC; public static bool Initial_flag; public static frmStart frmtmp; int filecount;//记录搜索到文件的个数; public frmSerach() { InitializeComponent(); m_objThreadC = new CThreadSearch(this, new SearchFileEventHandler(m_objThreadC_SearchEvent)); Initial_flag = false; filecount = 0; listViewFiles.DoubleClick += new EventHandler(listViewFiles_DoubleClick); this.cmntrv_Path.TreeView.ImageList = this.imglist;