|
제가 이거 못하면 회사 짤립니다. 바로 짤려요~
델파이 실력이 워낙 짧아서 못바꾸는 부분이 넘 많습니다.
알려 주셨으면 합니다. 감솨합니다.
procedure PrintBmp( ARect: TRect; ABitmap: TBitmap );
var
Info: PBitmapInfo;
InfoSize: DWORD;
Image: Pointer;
ImageSize: DWORD;
Bits: HBITMAP;
DIBWidth, DIBHeight: Longint;
begin
with Printer, Canvas do
begin
Bits := ABitmap.Handle;
GetDIBSizes( Bits, InfoSize, ImageSize );
Info := AllocMem( InfoSize );
try
Image := AllocMem( ImageSize );
try
GetDIB( Bits, ABitmap.Palette, Info^, Image^ );
with Info^.bmiHeader do
begin
DIBWidth := biWidth;
DIBHeight := biHeight;
end;
StretchDIBits( Printer.Canvas.Handle,
ARect.Left, ARect.Top, ARect.Right, ARect.Bottom,
0, 0, DIBWidth, DIBHeight,
Image, Info^, DIB_RGB_COLORS, SRCCOPY );
finally
FreeMem( Image, ImageSize );
end;
finally
FreeMem( Info, InfoSize );
end;
end;
end;
|