Convert Screen Rect to Printer Rect
-
I have a Rect say (0, 16, 0, 154) and i want to print it out with that same rect on a printer. on the printer dc i say int nOldMapMode = dc.SetMapMode(MM_HIENGLISH); dc.DPtoLP(rect); it converts it to (0, -27, 0, 257) wich is way to small for the printer. How do i convert this rect to the same rect for a printer? Scott
-
I have a Rect say (0, 16, 0, 154) and i want to print it out with that same rect on a printer. on the printer dc i say int nOldMapMode = dc.SetMapMode(MM_HIENGLISH); dc.DPtoLP(rect); it converts it to (0, -27, 0, 257) wich is way to small for the printer. How do i convert this rect to the same rect for a printer? Scott
HDC hdcPrinter;
CPrintDialog dlg(FALSE);
// get a dc for the screen and attach it to a CDC
CDC dcScreen;
HDC hdcScreen = ::GetDC(NULL);
dcScreen.Attach(hdcScreen);if (dlg.DoModal() == IDOK)
{
hdcPrinter=dlg.GetPrinterDC();long logicalPixelsPerInchX\_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSX); long logicalPixelsPerInchY\_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSY); long logicalPixelsPerInchX\_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSX); long logicalPixelsPerInchY\_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSY);
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
-
HDC hdcPrinter;
CPrintDialog dlg(FALSE);
// get a dc for the screen and attach it to a CDC
CDC dcScreen;
HDC hdcScreen = ::GetDC(NULL);
dcScreen.Attach(hdcScreen);if (dlg.DoModal() == IDOK)
{
hdcPrinter=dlg.GetPrinterDC();long logicalPixelsPerInchX\_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSX); long logicalPixelsPerInchY\_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSY); long logicalPixelsPerInchX\_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSX); long logicalPixelsPerInchY\_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSY);
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb