9
980
Unregistered / Unconfirmed
GUEST, unregistred user!
uses printers;<br>procedure PrintPanel(Panel: TPanel; SLeft, STop, SWidth, SHeight, Left, Top: LongInt;<br> HScale, ZScale: Real);<br>var<br> WJDC: HDC;<br> WJBitMap: TBitMap;<br> Info: PBitMapInfo;<br> InfoSize, ImageSize: DWORD;<br> Image: Pointer;<br>begin<br> Printer.BeginDoc;<br><br> WJBitMap := TBitMap.Create;<br> WJBitMap.Width := SWidth;<br> WJBitMap.Height := SHeight;<br><br> WJDC := GetDC(Panel.Handle);<br> BitBlt(WJBitMap.Canvas.Handle, 0, 0, SWidth, SHeight, WJDC, SLeft, STop, SRCCOPY);<br> ReleaseDC(Panel.Handle, WJDC);<br><br> GetDIBSizes(WJBitMap.Handle, InfoSize, ImageSize);<br> GetMem(Info, InfoSize);<br> GetMem(Image, ImageSize);<br> GetDIB(WJBitMap.Handle, 0, Info^, Image^);<br><br> StretchDIBits(Printer.Canvas.Handle, Left, Top, Round((Panel.Width - 2) * HScale),<br> Round((Panel.Height - 2) * ZScale), 0, 0, Info^.bmiHeader.biWidth,<br> Info^.bmiHeader.biHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY);<br> FreeMem(Image, ImageSize);<br> FreeMem(Info, InfoSize);<br> WJBitMap.Free;<br> Printer.EndDoc;<br>end;<br>我在Panel1上面放 很多Label1和edit ,想将Panel上显示的内容打印出来<br>我的调用方法是PrintPanel(Panel1,10,256,10,49,10,10,100,100);