给picturebox指定新图片前,要主动释放旧图片占用的内存
(vb代码)
If Not (Me.PictureBox1.Image Is Nothing) Then PictureBox1.Image.Dispose() PictureBox1.Image = NothingEnd If
C#
if ((this.PictureBox1.Image != null)) { PictureBox1.Image.Dispose(); PictureBox1.Image = null;}