TPrintDIB::StretchDrawDIB
Nonvisual
component derived from TComponent
StretchDrawDIB draws the
bitmap specified by the SourceBitmap parameter in the rectangle implied
from the x, y, Width, and Height parameters.
void __fastcall
StretchDrawDIB(Graphics::TCanvas* DestCanvas,
int x, int y,
int Width, int Height,
Graphics::TBitmap* SourceBitmap);
Description
Call StretchDrawDIB to draw
the bitmap specifed by SourceBitmap
on the canvas specified by DestCanvas
so that the image fits in the rectangle implied by x,
y, Width, and
Height. StretchDraw calls the
StretchDIBits method to render the bitmap. To render the bitmap in its
natural size, specify the bitmap's width and height as the Width
and Height
parameters, repsectively.
Example:
#include
<vcl\printers.hpp>
void __fastcall
TForm1::PrintButtonClick(TObject *Sender)
{
int
target_width = Printer()->PageWidth;
int
target_height = Printer()->PageHeight;
Printer()->BeginDoc();
PrintDIB1->StretchDrawDIB(Printer()->Canvas,
0, 0, target_width, target_height,
Image1->Picture->Bitmap);
Printer()->EndDoc();
}
|