回复 18楼 吹水佬
您好,现在找到了使用图片代码,我在表单中新建了一个方法程序hbtp
hbtp下的代码:
Declare Long GetDC In user32 Long
Declare Long ReleaseDC In user32 Long, Long
Declare Long GdiplusStartup In GDIPlus Long@, String@, Long
Declare Long GdiplusShutdown In GDIPlus Long
Declare Long GdipCreateBitmapFromScan0 In GDIPlus Long, Long, Long, Long, String@, Long@
Declare Long GdipGetImageGraphicsContext In GDIPlus Long, Long@
Declare Long GdipCreateFromHDC In GDIPlus Long, Long@
Declare Long GdipLoadImageFromFile In GDIPlus String@, Long@
Declare Long GdipGetImageWidth In GDIPlus Long, Long@
Declare Long GdipGetImageHeight In GDIPlus Long, Long@
Declare Long GdipSaveImageToFile In GDIPlus Long, String@, String@, Long
Declare Long GdipDrawImageRectI In GDIPlus Long, Long, Long, Long, Long, Long
Declare Long GdipDisposeImage In GDIPlus Long
Declare Long GdipDeleteGraphics In GDIPlus Long
outFile = "合并.png"
wjm='abcde'
inFile1='.\临时\'+Left(wjm,1)+'.png'
IF !FILE(inFile1)
retu
endif
stGSI = 0h01000000000000000000000000000000
pGDI = 0
GdiplusStartup(@pGDI, @stGSI, 0)
pImage1 = 0
GdipLoadImageFromFile(Strconv(inFile1+0h00,5), @pImage1)
nWidth1 = 0
GdipGetImageWidth(pImage1, @nWidth1)
nHeight1 = 0
GdipGetImageHeight(pImage1, @nHeight1)
N=Len(wjm)
nWidth = nWidth1*N
nHeight = nHeight1
PixelFormat_32bppARGB = 0x26200A
pBitmap = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, PixelFormat_32bppARGB, 0, @pBitmap)
pGraphics = 0
GdipGetImageGraphicsContext(pBitmap, @pGraphics)
GdipDrawImageRectI(pGraphics, pImage1, 0, 0, nWidth1, nHeight1)
For i=2 To N
inFile2='.\临时\'+Substr(wjm,i,1)++Right(m_dx,4)
IF FILE(inFile2)
pImage2 = 0
GdipLoadImageFromFile(Strconv(inFile2+0h00,5), @pImage2)
ii=nWidth1*(i-1)
GdipDrawImageRectI(pGraphics, pImage2, ii, 0, nWidth1, nHeight1)
endif
Endfor
CLSID_BMP = 0h00F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(pBitmap, Strconv(outFile+0h00,5), CLSID_BMP, 0)
GdipDisposeImage(pImage1)
GdipDisposeImage(pImage2)
GdipDeleteGraphics(pGraphics)
GdipDisposeImage(pBitmap)
GdiplusShutdown(pGDI)
pImage = 0
GdipLoadImageFromFile(Strconv(outFile+0h00,5), @pImage)
hDC = GetDC(_Screen.HWnd)
pGraphics = 0
GdipCreateFromHDC(hDC, @pGraphics)
GdipDrawImageRectI(pGraphics, pImage, 10, 10, 500, 500*nHeight/nWidth)
GdipDisposeImage(pImage)
GdipDeleteGraphics(pGraphics)
ReleaseDC(_Screen.HWnd, hDC)
是把文件夹下图片合并成一个图片,这些代码是网上找的也不明白,只是做了些修改。
执行thisform.hbtp后图片被占用不能删除,请问老师如何释放掉?谢谢
[此贴子已经被作者于2022-2-17 06:30编辑过]