L_BM_PRINT
Send this message to print an L_BITMAPCLASS window's bitmap.
Use this message with a LEADBITMAPPRINT structure, which lets you position the image on the printed page, and lets you print more than one image on the page.
Parameter |
Meaning |
wParam |
Specifies whether the window should be redrawn to reflect the image changes. Use 1 to redraw the window, or 0 not to redraw it. |
lParam |
Points to a LEADBITMAPPRINT structure. For a description, refer to the LEADBITMAPPRINT structure described below. |
Returns
>0 |
Function was successful. If the fEndDOC field in the LEADBITMAPPRINT structure is FALSE, the return value is the printer HDC. |
0 |
An error occurred. |
LEADBITMAPPRINT Structure
The L_BM_PRINT message lets you print an image in the L_BITMAPCLASS registered class. Before sending the message, your program must declare a LEADBITMAPPRINT structure.
You can specify the position and dimensions of the printed image, or let LEADTOOLS calculate values for you as follows:
You can specify the X and Y offsets of the image, or you can let LEADTOOLS center the image vertically, horizontally, or both.
You can specify the width, and let LEADTOOLS calculate the height to preserve the aspect ratio.
You can specify the height, and let LEADTOOLS calculate the width to preserve the aspect ratio.
You can let LEADTOOLS calculate the maximum printed width and height, while preserving the aspect ratio.
The structure is designed to let you print multiple bitmaps on the same page. To do so, send the message with the fEndDoc field set to FALSE for each image except the last one on the page. Then send the message with the fEndDoc field set to TRUE. If you do not set the fEndDoc field to TRUE in the last message, the hDC will not be freed, and the page will not flush.
The following table describes the fields in the structure, using MyPrint as the name of the LEADBITMAPPRINT structure:
Sample Field Name |
Data Type |
Description |
MyPrint.uStructSize |
Size of the LEADBITMAPINFO structure. This field allows for compatibility with future enhancements. It can be specified as follows: MyPrint.uStructSize = sizeof(MyPrint); | |
MyPrint.hDC |
HDC |
Handle to the device context (DC) where the bitmap is to print. The mapping mode of the device context must be MM_TEXT. |
MyPrint.nXPos |
X position to start the print. Pass a 0 to center the image horizontally on the page. | |
MyPrint.nYPos |
Y position to start the print. Pass a 0 to center the image vertically on the page. | |
MyPrint.nXSize |
The printed width. The value is in dots, and the actual width depends on the dots per inch (DPI) of the printer. Pass a 0 to let LEADTOOLS calculate the width. If you specify only the width or only the height, LEADTOOLS calculates the remaining dimension. If you pass zeros for both width and height, LEADTOOLS calculates the maximum dimensions that fit on the page while preserving the aspect ratio. | |
MyPrint.nYSize |
The printed height. The value is in dots, and the actual height depends on the dots per inch (DPI) of the printer. Pass a 0 to let LEADTOOLS calculate the height. If you specify only the width or only the height, LEADTOOLS calculates the remaining dimension. If you pass zeros for both width and height, LEADTOOLS calculates the maximum dimensions that fit on the page while preserving the aspect ratio. | |
MyPrint.fEndDoc |
This is used to let LEADTOOLS know whether you plan to print another image on the same page or not. |