|
zoro 님이 쓰신 글 :
: 안녕하세요
: 컴파일 에러는 없어요...
:
: 써보시고 잘안되면 연락주셔요..
:
: 즐거운 하루 되십시요..
:
: #include <Graphics.hpp>
: #include <printers.hpp>
:
: void PrintBmp(TRect ARect, Graphics::TBitmap *ABitmap)
: {
: LPBITMAPINFO Info;
: DWORD InfoSize;
: LPVOID Image;
: DWORD ImageSize;
: HBITMAP Bits;
: DWORD DIBWidth, DIBHeight;
:
: Bits = ABitmap->Handle;
: GetDIBSizes(Bits, InfoSize, ImageSize);
: Info = (LPBITMAPINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, InfoSize);
: try
: {
: Image = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ImageSize);
: try
: {
: GetDIB( Bits, ABitmap->Palette, Info, Image);
: DIBWidth = Info->bmiHeader.biWidth;
: DIBHeight = Info->bmiHeader.biHeight;
: StretchDIBits(Printer()->Canvas->Handle,
: ARect.Left, ARect.Top, ARect.Right, ARect.Bottom,
: 0, 0, DIBWidth, DIBHeight,
: Image, Info, DIB_RGB_COLORS, SRCCOPY );
: }
: __finally
: {
: HeapFree(GetProcessHeap(), 0, Image);
: }
: }
: __finally
: {
: HeapFree(GetProcessHeap(), 0, Info);
: }
: }
:
:
:
: 해당화 님이 쓰신 글 :
: : 제가 이거 못하면 회사 짤립니다. 바로 짤려요~
: : 델파이 실력이 워낙 짧아서 못바꾸는 부분이 넘 많습니다.
: : 알려 주셨으면 합니다. 감솨합니다.
: :
: : 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;
: :
: : u
|