回复 37楼 吹水佬
修改了下,效果不错!周末愉快!
程序代码:
*** test.prg ***
CLEAR
#DEFIN PixelFormat32bppARGB 0x26200A
DECLARE LONG GdipCreateBitmapFromScan0 IN gdiplus.dll LONG, LONG, LONG, LONG, STRING@, LONG@
DECLARE LONG GdipGetImageGraphicsContext IN gdiplus.dll LONG, LONG@
DECLARE LONG GdipSaveImageToFile IN gdiplus.dll LONG, STRING@, STRING@, LONG
DECLARE LONG GdipDisposeImage IN gdiplus.dll LONG
DECLARE LONG GdipDeleteGraphics IN gdiplus.dll LONG
oRL = CREATEOBJECT("ReportListener")
oRL.ListenerType = 3
REPORT FORM ? OBJECT oRL
for aa = 1 to oRL.PageTotal
LOCAL nWidth, nHeight, hBitmap, hGraphics, cFile, bmpGUID
nWidth = oRL.GetPageWidth()/4
nHeight = oRL.GetPageHeight()/4 && 分辨率太大图片好象有点不正常,情况不明。
hBitmap = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, PixelFormat32bppARGB, 0, @hBitmap)
IF hBitmap == 0
? "创建Bitmap失败"
RETURN
ENDIF
hGraphics = 0
GdipGetImageGraphicsContext(hBitmap, @hGraphics)
IF hGraphics == 0
GdipDisposeImage(hBitmap)
? "获取Graphics失败"
RETURN
ENDIF
oRL.OutputPage(aa, hGraphics, 1, 0,0,nWidth,nHeight, 0,0,nWidth,nHeight)
cFile = "D:\temp\kkkk" + alltrim(str(aa)) + ".png"
bmpGUID = 0h06F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(hBitmap, STRCONV(cFile+0h00,5),@bmpGUID,0)
GdipDisposeImage(hBitmap)
GdipDeleteGraphics(hGraphics)
endfor