求大神帮改进imagelist缩略图加载效率
程序代码:
foreach (string image in images) { progressBar1.Value = progressBar1.Value + 1; FileStream files = new FileStream(image, FileMode.Open, FileAccess.Read, FileShare.Read); byte[] imgByte = new byte[files.Length]; files.Read(imgByte, 0, imgByte.Length); StreamReader r = new StreamReader(files, Encoding.ASCII); if (imgByte[imgByte.Length - 1] != 0) { Bitmap Temp = new Bitmap(Image.FromStream(files)); files.Close(); narTemp = new Bitmap(imageList1.ImageSize.Width, imageList1.ImageSize.Height); Graphics g = Graphics.FromImage(narTemp); Picsize = FitSize(Temp.Width, Temp.Height, narTemp.Width, narTemp.Height); Point tempxy; tempxy = PointXY(Picsize, narTemp.Width, narTemp.Height); g.DrawImage(Temp, 0, 0, (int)(Temp.Width * Picsize.fitsize), (int)(Temp.Height * Picsize.fitsize)); imageList1.Images.AddStrip(narTemp); if (progressBar1.Value == images.Count) { label3.Text = "加载完毕!"; label3.Refresh(); } else { label3.Text = "已经加载" + progressBar1.Value.ToString() + "张"; label3.Refresh(); } g.Dispose(); Temp.Dispose(); GC.Collect(); } }由于imagelist自动适配会使得图像走形 所以我将图像适配imagelist大小后重新绘制到imagelist中 但是问题是读取1MB以上的图像明显吃力 请问如何解决这一问题?