通用错误发生GDI + [英] Generic Error Occured GDI+

查看:66
本文介绍了通用错误发生GDI +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨,,







Hi,,



Dim fs As New FileStream(Filename, FileMode.Open, FileAccess.Read, FileShare.Read)
       'Dim fs As FileStream = File.Open(Filename, FileMode.Open, FileAccess.Read)
       Dim bm As System.Drawing.Bitmap = CType(System.Drawing.Bitmap.FromStream(fs), System.Drawing.Bitmap)
       bm.SelectActiveFrame(FrameDimension.Page, FrameNumber)
       Dim temp As New System.Drawing.Bitmap(bm.Width, bm.Height)
       Dim g As Graphics = Graphics.FromImage(temp)
       g.InterpolationMode = InterpolationMode.NearestNeighbor
       g.DrawImage(bm, 0, 0, bm.Width, bm.Height)







// Dim fs作为新FileStream(文件名,FileMode。打开,FileAccess.Read,FileShare.Read)



这行代码提出了一般性错误GDI +只有1或2个案例中的100个..

我正尝试从tiff阅读框架。更多停止工作..请帮助我,如果你有任何想法



标题:GUI +已更改到GDI +,标签从C#变为VB - OriginalGriff [/ edit]




//Dim fs As New FileStream(Filename, FileMode.Open, FileAccess.Read, FileShare.Read)

this line of code raising generic error occured GDI+ only 1 or 2 cases out of 100..
am trying read frame from tiff..more ceases its working ..please help me if u have any idea

[edit]Title: "GUI+" changed to "GDI+", tags changed from C# to VB - OriginalGriff[/edit]

推荐答案

为什么不使用

Why not just use
Dim dm As Bitmap = DirectCast(Image.FromFile(Filename), Bitmap)
bm.SelectActiveFrame(FrameDimension.Page, FrameNumber)





如果你得到了每次在同一文件上出错,那么该文件可能包含错误信息或.NET不理解的信息。我会使用Try ... Catch语句,记录我的问题并查看代码外的文件,看看它们是否有一个共同的因素作为第一阶段。



If you are getting the error on the same file each time, then it is likely that the file contains bad information, or info that .NET does not understand. I would use a Try...Catch statement, log my problems and review the files outside the code to see if they have a common factor as the first stage.


一旦尝试这样

Dim fs As New FileStream(Filename,FileMode.Open,FileAccess.Read)
once try like this
Dim fs As New FileStream(Filename, FileMode.Open, FileAccess.Read)


这篇关于通用错误发生GDI +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆