J
JoeB
Hi,
I need to load a bitmap resource an BitBlt it to a printer device context. I
cannot figure out how to do this. I would imagine that it is fairly simple
task, but i have no nolodge of device contexts that the whole this is
scaring me a little!
< im using the compact framework >
what i have:
Bitmap bm = new Bitmap(Utils.GetApplicationPath() + @"Bitmap1.bmp");
if( bm == null )
{
throw new Exception("Failed to load bitmap");
}
// load bitmap works ok.
// create working DC:
IntPtr TmpDC = GdiGraphics.CreateCompatibleDC( hPrinterDC );
// this fails, cannot convert 'bm' from Bitmap to IntPtr:
GdiGraphics.BitBlt( TmpDC, 0,0, bm.Width, bm.Height, bm, 0,0,
GdiGraphics.SRCCOPY );
Print( TmpDC );
GdiGraphics.DeleteObject( TmpDC );
GC.Collect(); // run garbage collection manually
Any ideas what im doing wrong??
TIA.
Joe
I need to load a bitmap resource an BitBlt it to a printer device context. I
cannot figure out how to do this. I would imagine that it is fairly simple
task, but i have no nolodge of device contexts that the whole this is
scaring me a little!
< im using the compact framework >
what i have:
Bitmap bm = new Bitmap(Utils.GetApplicationPath() + @"Bitmap1.bmp");
if( bm == null )
{
throw new Exception("Failed to load bitmap");
}
// load bitmap works ok.
// create working DC:
IntPtr TmpDC = GdiGraphics.CreateCompatibleDC( hPrinterDC );
// this fails, cannot convert 'bm' from Bitmap to IntPtr:
GdiGraphics.BitBlt( TmpDC, 0,0, bm.Width, bm.Height, bm, 0,0,
GdiGraphics.SRCCOPY );
Print( TmpDC );
GdiGraphics.DeleteObject( TmpDC );
GC.Collect(); // run garbage collection manually
Any ideas what im doing wrong??
TIA.
Joe