JohnPaulBR
1/3/2005 12:37:00 PM
Hello,
I´m trying to print an image (captured by scanner), using the
System.Drawing.Image.FromHbitmap(IntPtr Hbitmap). When I run the program, it
works fine, I can capture the image. But when I select to print, an unhandled
exception occurs, as follow:
An unhandled exception of type
'System.Runtime.InteropServices.ExternalException' occurred in
system.drawing.dll
Additional information: A generic error occurred in GDI+.
When I use the try-catch block, I receive the following information:
"A generic error occurred in GDI+.
stack trace: System.Drawing.Image.FromHbitmap(IntPtr Hbitmap)"
this is my code:
private void printDocument1_PrintPage(System.Object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
Image img2 = Image.FromHbitmap(bmpptr); //the bmpptr var is the image
handle, obtained by the scanning
e.Graphics.DrawImage(img2, 0, 0);
}
Please if somebody could give a tip, I will be very thankful!
--
John Paul