內部的Try/Catch塊則包圍在targetImage外部
通過調用Dispose方法
Using語句可簡化前面的代碼
Public Shared Sub GenerateThumbnail(ByVal SourceImagePath As String
Dim newHeight As Short
Dim newWidth As Short
Using sourceImage As Image = Image
newHeight = CShort(sourceImage
newWidth = CShort(sourceImage
Dim cb As New Image
Using targetImage As Image = sourceImage
targetImage
End Using
End Using
[
From:http://tw.wingwit.com/Article/program/net/201311/15275.html