private void sample_exam_thread() { string strReadLine; string regexStr = @"[-+]?\b(?:[0-9]*\.)*[0-9]+\b"; MatchCollection mc; uint i = 1; PCAS.set_radius(d); PCAS.set_angle(a); PCAS.set_sample(sample); while (i < sample) { if (cycle == true) { PCAS.move_to_sample(i); } else { if (i > x.Count - 1) { break; } PCAS.microscopexy(x[(int)i], y[(int)i]); } this.set_sampleid(i.ToString()); Thread.Sleep(100); picture.Record_the_picture(i); Thread.Sleep(100); if (reportfile != null) { strReadLine = reportfile.ReadLine(); //读取每行数据 //while (!reportfile.EndOfStream) // strReadLine = reportfile.ReadLine(); //读取每行数据 if (strReadLine != null) { mc = Regex.Matches(strReadLine, regexStr); if (mc.Count >= 9) { dataGridView1[3, (int)i - 1].Value = mc[7].Value; } } } if (exam_start == false) { return; } Thread.Sleep(time); i++; } exam_start = false; set_exam("检测"); }