我用過了,程序是動態加載控件,并從一個二進制的資源文件中將所用到的圖像寫入臨時文件,賦給相應的PictureBox,在窗體退出時
Dim Ctrl As System.Windows.Forms.Control
For Each Ctrl In Me.Controls
If TypeName(Ctrl) = "PictureBox" Then
CType(Ctrl, System.Windows.Forms.PictureBox).Image = Nothing
CType(Ctrl, System.Windows.Forms.PictureBox).Dispose()
End If
Next
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
PictureBox1.Image = Nothing
PictureBox1.Dispose()
GC.Collect()
System.IO.File.Delete("f:\cym\temp\666.gif")
End Sub