943,667 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 3346
  • C# RSS
Mar 27th, 2008
0

General GDI+ Error

Expand Post »
Hello,
I am getting a General GDI+ Error according to the Visual C# debugger. i have no idea as to how to handle this problem. I have a button which i click and a section of the screen is cut and put into a bitmap. This is converted into tiff format which is sent for OCR using MODI. The first time I click the button it works, however, when i click the button again, I get a the error. Here is the line it is being pointed to:

bitonalBitmap.Save(@"c:\Bitonal-Out.tif", imageCodecInfo, encoderParameters);

Can anyone help me please.
Thanks in advance.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Barbarrosa is offline Offline
27 posts
since Jan 2008
Mar 28th, 2008
0

Re: General GDI+ Error

I added a
try
{
code
}
catch...
Im finding that every second time I click the button, it works... if that helps anyone to understand this better...
Reputation Points: 10
Solved Threads: 0
Light Poster
Barbarrosa is offline Offline
27 posts
since Jan 2008
Mar 31st, 2008
0

Re: General GDI+ Error

First, have u got any more information on the type of exception you are getting? and what exactly is the error message?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Reinard is offline Offline
7 posts
since Mar 2008
Mar 31st, 2008
0

Re: General GDI+ Error

Sorry, should have posted that as well...

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at BitonalConverter.Form1.OCRProcess(Int32 StartX, Int32 StartY, Int32 EndX, Int32 EndY, String file) in C:\Documents and Settings\user\Desktop\Bitonal\BitonalImageConverter_src\Bitonal\Bitonal.cs:line 58
at BitonalConverter.Form1.Process_Click(Object sender, EventArgs e) in C:\Documents and Settings\user\Desktop\Bitonal\BitonalImageConverter_src\Bitonal\Bitonal.cs:line 111
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Maybe this will help... I tried to delete the Bitmap after and was getting a "File used in another process error" which i also posted on another thread
Reputation Points: 10
Solved Threads: 0
Light Poster
Barbarrosa is offline Offline
27 posts
since Jan 2008
Apr 1st, 2008
0

Re: General GDI+ Error

Do you dispose of all your resources after the 1st button click? Do you specify a filename or is it a static filename you are using? sorry for all the questions im trying to determine more or less what may be the cause of this exception
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Reinard is offline Offline
7 posts
since Mar 2008
Aug 25th, 2008
0

Re: General GDI+ Error

Click to Expand / Collapse  Quote originally posted by Reinard ...
Do you dispose of all your resources after the 1st button click? Do you specify a filename or is it a static filename you are using? sorry for all the questions im trying to determine more or less what may be the cause of this exception
Yes we do same as you mentioned.
Please reply me for the solution.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
anooprawat2 is offline Offline
1 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: on minimize
Next Thread in C# Forum Timeline: Hiding seek bar in Media player control Using C# windows application





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC