我用的Image.FromFile
出现了
An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Drawing.dll
Additional information: Out of memory.
的错误,网上很多都说是我的tif文件有问题,不过我的tif 8m在acdsee里面能正常打开,请问怎么解决,谢谢
...全文
2456打赏收藏
请教一下各位,tif图片在picturebox里面加载的问题
我用的Image.FromFile 出现了 An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Drawing.dll Additional information: Out of memory. 的错误,网上很多都说是我的tif文件有问题,不过我的tif 8m在acdsee里面能正常打开,请问怎么解决,谢谢
Public Function setPicture(ByVal strFile As String, ByRef pic As PictureBox, ByVal backPic As PictureBox, ByVal lblMassage As Label) As Boolean
Try
If InStr(strFile, ".tif") > 0 Or InStr(strFile, ".TIF") > 0 Then
lblMassage.Visible = False
Application.DoEvents()
pic.Image = Nothing
'Dim guid As FrameDimension
Dim img As Image
img = Image.FromFile(strFile)
'guid = FrameDimension.Page
'img.SelectActiveFrame(guid, 0)
pic.Image = img
End If
Catch ex As Exception
Return False
End Try
Return True
End Function