C#控件刷新


 1 int count = 0;
 2 int success_count = 0;
 3 foreach (string gen in fn_gen)
 4 {
 5     //MessageBox.Show(gen);
 6     Bitmap Bi = new Bitmap(gen);  //使用打開的圖片路徑創建位圖對像
 7     Image Image = Bi;
 8     if (Image.Width >= 170 && Image.Height >= 200)
 9     { 
10         string destinationFile = result + gen.Substring(gen.LastIndexOf(@"\"), gen.Length - gen.LastIndexOf(@"\"));
11         bool isrewrite = true; // true=覆蓋已存在的同名文件,false則反之
12         System.IO.File.Copy(gen, destinationFile, isrewrite);
13         success_count++;
14         this.Txt_Count.Refresh();
15         this.Txt_Count.Text = success_count.ToString() + "/" + count.ToString();
16         Application.DoEvents();// Application.DoEvents()的作用:處理所有的當前在消息隊列中的Windows消息。
17         System.Threading.Thread.Sleep(100);
18     }
19     count++;
20     Bi = null;
21     System.GC.Collect();
22 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM