|
-
August 11th, 1999, 01:19 PM
#1
print screen, urgent PLEASE
Hi,
I have a BIG problem with my application and I don't know what to do. Can you PLEASE help me?
My program displays (CScrollView) one big bitmap (CBitmap) and some lines (LineTo) on it.
I have to add a print screen option, so I use:
HDC hDC;
DOCINFO di;
CRect myRect;
CPrintDialog dlgPrint(FALSE);
GetWindowRect(&myRect);
if (dlgPrint.DoModal() == IDOK)
{
hDC = dlgPrint.GetPrinterDC();
memset(&di, 0, sizeof( DOCINFO ) );
di.cbSize = sizeof( DOCINFO );
di.lpszDocName = "Dyread";
StartDoc( hDC, &di );
StartPage( hDC );
int printer_w = GetDeviceCaps(hDC,VERTRES);
int printer_h = GetDeviceCaps(hDC,HORZRES);
//print the bitmap
StretchBlt(hDC,0, 0, printer_w, printer_h, GetDC()->GetSafeHdc(),
0, 0, myRect.Width(),myRect.Height(), SRCCOPY);
CDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//print the lines
.....
EndPage( hDC );
EndDoc( hDC );
DeleteDC( hDC );
}
The problem is that I use MM_TEXT map mode, so the pixels on my screen and the dots on the printer are different sizes.
The bitmap looks terrible (StretchBlt)!
I tried to use MM_LOENGLISH but then the bitmap doesn't appear
Can you PLEASE help me?
Thanks
C.J.
-
August 11th, 1999, 02:06 PM
#2
Re: print screen, urgent PLEASE
are you try with Bitblt()?
-
August 11th, 1999, 02:57 PM
#3
Re: print screen, urgent PLEASE
The reason that the bitmap doesn't appear in MM_LOENGLISH is because in this mapping mode, 0 on the Y axis is at the bottom of the screen/page, so you need to start drawing the bitmap at X = 0 and Y = 0 - Height_Of_Bitmap.
-
August 11th, 1999, 11:49 PM
#4
Re: print screen, urgent PLEASE
I'm about to look at the problem myself. I found a section in Books Online for VC++ 4.0. The path is Win32 SDK:Win32, Overviews. Graphics Device Interface - Printing a Document. The section includes sample code for printing a bitmap (from a file) to scale and text on the same page. The comment about the MM_LOENGLISH mapping mode is accurate. Y coordinates start at 0 at the top of the screen and are negative below that, the opposite sign of MM_TEXT mapping mode. Hope I pointed you in the right direction.
-
August 13th, 1999, 09:17 AM
#5
Re: print screen, urgent PLEASE
Hi,
I've tried and tried but it doesn't work
Can someone PLEASE write a small program that prints (to printer) one CBitmap and afew lines on it?
many thanks,
C.J.
-
August 13th, 1999, 03:31 PM
#6
Re: print screen, urgent PLEASE
As a general rule, I use DrawDibDraw() in vfw.dll. I use it almost exclusively because it handles palette issues without any help from me whatsoever, and does stretching/shrinking better as well. Maybe it will help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|