Hide

SftPrintPreview/DLL 2.0 - Print Preview Control for C/C++

Display
Print

PrintBitmap Function

The PrintBitmap function displays/prints a device dependent bitmap.

C

BOOL CALLBACK SftPrintPreview_PrintBitmap(
    HBITMAP hBitmap,
    HDC hDCPrinter,
    int xPrinter,
    int yPrinter,
    int wPrinter,
    int hPrinter,
    int widthBitmap,
    int heightBitmap);

C++

static BOOL CSftPrintPreview::PrintBitmap(
    HBITMAP hBitmap,
    HDC hDCPrinter,
    int xPrinter,
    int yPrinter,
    int wPrinter,
    int hPrinter,
    int widthBitmap,
    int heightBitmap);

Parameters

hBitmap

The bitmap handle of the bitmap to be printed.

hDCPrinter

The printer device context.

xPrinter

The horizontal offset in printer coordinates, where the bitmap is printed.

yPrinter

The vertical offset in printer coordinates, where the bitmap is printed.

wPrinter

The width of the printed bitmap (in printer coordinates).

hPrinter

The height of the printed bitmap (in printer coordinates).

widthBitmap

The width of the bitmap (in pixels, screen coordinates).

heightBitmap

The height of the bitmap (in pixels, screen coordinates).

Returns

The return value is TRUE if successful, FALSE otherwise.

Comments

The PrintBitmap function displays/prints a device dependent bitmap.

Device dependent bitmaps (screen bitmaps) can be printed using the PrintBitmap function. Screen bitmaps cannot usually 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.

The GetBitmapSize function retrieves the display and print size of a device dependent bitmap.

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


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.