好复杂啊
*VFP6.0代码 *更改图片尺寸的大小 =resizeimage([f:\yyrj\3.jpg],[f:\yyrj\31.jpg],400,300) Declare INTEGER ShellExecute IN shell32; INTEGER hwnd, STRING lpOperation,; STRING lpFile, STRING lpParameters,; STRING lpDirectory, INTEGER nShowCmd = ShellExecute (0, [open], [f:\yyrj\3.jpg],[],[], 3) && 原图 =INKEY(2) && 等待2秒钟再查看新图 = ShellExecute (0, [open], [f:\yyrj\31.jpg],[],[], 3) && 新图 ******************************************* *算法制作:行者孙(QQ:310727570) ******************************************* FUNCTION RESIZEIMAGE PARAMETERS pSourceFileNAme,pNewFileNAme,nWidth,nHeight DECLARE INTEGER GdiplusStartup IN gdiplus INTEGER @token, STRING @INPUT, INTEGER OUTPUT LOCAL hToken, cInput hToken = 0 cInput = PADR(CHR(1), 16, CHR(0)) GdiplusStartup(@hToken, @cInput, 0) DECLARE INTEGER GdipLoadImageFromFile IN gdiplus.DLL STRING wFilename, INTEGER @nImage LOCAL nImage nImage = 0 GdipLoadImageFromFile(STRCONV(pSourceFileNAme + CHR(0), 5), @nImage) #DEFINE GDIPLUS_PIXELFORMAT_32bppARGB 0x0026200A DECLARE INTEGER GdipCreateBitmapFromScan0 IN gdiplus.DLL ; INTEGER nWidth, INTEGER nHeight, INTEGER nStride; , INTEGER nPixelFormat, STRING @cScan0, INTEGER @nImage LOCAL nBitmap, nX, nY nBitmap = 0 nX = 0 nY = 0 GdipCreateBitmapFromScan0(nWidth, nHeight, 0, GDIPLUS_PIXELFORMAT_32bppARGB, 0, @nBitmap) DECLARE INTEGER GdipGetImageGraphicsContext IN gdiplus.DLL INTEGER nImage, INTEGER @ nGraphics LOCAL nGraphics nGraphics = 0 GdipGetImageGraphicsContext (nBitmap, @nGraphics) DECLARE INTEGER GdipDrawImageRect IN gdiplus.DLL ; INTEGER nGraphics, INTEGER nImage, SINGLE,SINGLE,SINGLE,SINGLE GdipDrawImageRect(nGraphics, nImage, nX, nY, nWidth, nHeight) LOCAL lcEncoder lcEncoder = REPLICATE(CHR(0),16) DECLARE INTEGER CLSIDFromString IN ole32 STRING lpsz, STRING @pclsid CLSIDFromString(STRCONV("{557CF401-1A04-11D3-9A73-0000F81EF32E}" + CHR(0), 5), @lcEncoder) DECLARE INTEGER GdipSaveImageToFile IN gdiplus.DLL ; INTEGER nImage, STRING wFilename, STRING qEncoder, INTEGER nEncoderParamsPtr ERASE (pNewFileNAme) DECLARE Long GdipDisposeImage IN Gdiplus.dll Long nativeImage GdipDisposeImage(nImage) GdipSaveImageToFile (nBitmap, STRCONV(pNewFileNAme,5) + CHR(0), lcEncoder, 0) DECLARE INTEGER GdiplusShutdown IN gdiplus INTEGER token GdiplusShutdown(hToken) CLEAR DLLS ENDFUNC