我想知道下面的代码块是否安全,这意味着如果出现问题,gfx会自行处理吗?
Using gfx As Graphics = Graphics.FromImage(img)
gfx.Clear(Color.Transparent)
gfx.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
End Using
是的,这就是using
关键字的全部意义。从这里:
使用块保证处理当你的代码已经完成了。这使它们可用于其他代码使用