|
|
|
GetBitmapSize |
The GetBitmapSize function retrieves the display and print size of a device dependent bitmap.
C
BOOL CALLBACK SftPrintPreview_GetBitmapSize( HBITMAP hBitmap, HDC hDCPrinter, int* wPrinter, int* hPrinter, int* wScreen, int* hScreen);
C++
static BOOL CSftPrintPreview::GetBitmapSize( HBITMAP hBitmap, HDC hDCPrinter, int* wPrinter, int* hPrinter, int* wScreen, int* hScreen);
Parameters
hBitmap
The bitmap handle of the bitmap, for which the dimensions are returned.
hDCPrinter
The printer device context.
wPrinter
A pointer where the printed width of the bitmap (in pixels) is returned.
hPrinter
A pointer where the printed height of the bitmap (in pixels) is returned.
wScreen
A pointer where the screen width of the bitmap (in pixels) is returned.
hScreen
A pointer where the screen height of the bitmap (in pixels) is returned.
Returns
The return value is TRUE if successful, FALSE otherwise.
Comments
The GetBitmapSize function retrieves the display and print size of a device dependent bitmap.
Device dependent bitmaps (screen bitmaps) can be printed using the PrintBitmap function. Screen bitmaps cannot usually not be printed using BitBlt. The PrintBitmap function is used to print bitmaps instead. When printing a screen bitmap, the width and height of the bitmap need to be scaled to retain their approximate original dimensions once printed.
Example
C
// Print a bitmap int wPrinter, hPrinter, w, h; // get bitmap size SftPrintPreview_GetBitmapSize(m_MainBitmap, hDCPrinter, &wPrinter, &hPrinter, &w, &h); // print bitmap, horizontally centered SftPrintPreview_PrintBitmap(m_MainBitmap, hDCOutput, 0, 0, wPrinter, hPrinter, w, h);
C++
// Print a bitmap int wPrinter, hPrinter, w, h; // get bitmap size CSftPrintPreview::GetBitmapSize(m_MainBitmap, hDCPrinter, &wPrinter, &hPrinter, &w, &h); // print bitmap, horizontally centered CSftPrintPreview::PrintBitmap(m_MainBitmap, hDCOutput, 0, 0, wPrinter, hPrinter, w, h);
See Also C/C++ API | C++ Classes | Notifications