/// <summary> /// 把剩余的图片和txt重新命名 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFinish_Click(object sender, EventArgs e) { DirectoryInfo dir = new DirectoryInfo(_path); FileInfo[] files = dir.GetFiles(); if (files.Count() == 0) { empty = true; MessageBox.Show("File is Empty!"); pictureBox1.Refresh(); return; } int txtFile = 1; int imaIndex = 1; foreach (FileInfo item in files) { if (item.Extension == ".bmp") { File.Move(item.FullName,_path+"\\"+imaIndex.ToString()+".bmp"); imaIndex++; } else { File.Move(item.FullName,_path+"\\"+ txtFile.ToString()+".txt"); txtFile++; } } MessageBox.Show("Order is finished !"); Initial(trackBar1.Value); }