日期:2014-05-20  浏览次数:20873 次

GDI+位图使用完毕后Dispose没有完全对对象进行销毁为何?
    progressBar1.Maximum = images.Count;
                    foreach (string image in images)
                    {
                        progressBar1.Value = progressBar1.Value + 1;
                        
                        using (Bitmap Temp = new Bitmap(Image.FromFile(image))) 
                        {
                            using (Bitmap narTemp = new Bitmap(imageList1.ImageSize.Width, imageList1.ImageSize.Height))
                            {
                                using (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));
                                    //g.Dispose();
                                    //imageList1.Images.Add(narTemp);
                                    g.Dispose();