this.PictureBox1.Image = Image.FromFile("C:\\Documents and Settings\\Administrator\\桌面\\TextPicture.bmp");给FORM 的图形控件加载图片, 窗体占用 TextPicture.bmp然后我用
this.PictureBox1.Image = null;释放图片,但是这样的操作,  TextPicture.bmp 不能立刻释放, 就是说一段时间内仍然处于被占用状态怎样操作才能立刻释放这个 TextPicture.bmp 志愿

解决方案 »

  1.   

    this.PictureBox1.Image = null; 
    只是指定Image不再引用托管堆的内存
    立即释放不清楚 帮你顶
      

  2.   


    this.PictureBox1.Dispose();
    this.PictureBox1.Image = null;
      

  3.   

    错了,应该是:this.PictureBox1.Image.Dispose();
    this.PictureBox1.Image = null;
      

  4.   

    xb_feng  的答案完全正确 做个总结前面我单独使用过
    this.PictureBox1.Image.Dispose();
    如果不执行this.PictureBox1.Image = null;
    ,即给this.PictureBox1赋新值,窗体重绘会死程序this.PictureBox1.Image.Dispose();
    this.PictureBox1.Image = null;完美解决! 收录入BLOG