本帖最后由 nmgwddj 于 2012-2-5 19:09 编辑
回复 13# afan
貌似不可行,莫非是我哪里理解错误了!#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#region ### START Koda GUI section ### Form=
$sInPic = 'AddMore.bmp'
$Image = _ImageRectToFile($sInPic, 339, 0, 113, 50)
;ShellExecute($sOutPic)
$Form1 = GUICreate("Form1", 623, 448, 229, 170)
$Pic1 = GUICtrlCreatePic($Image, 120, 72, 204, 84)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _ImageRectToFile($sInPic, $iSrcX, $iSrcY, $iSrcW, $iSrcH, $iDstX = 0, $iDstY = 0, $iDstW = $iSrcW, $iDstH = $iSrcH)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($sInPic)
$hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
$hImage1 = _GDIPlus_BitmapCreateFromGraphics($iDstW, $iDstH, $hGraphics)
$hGraphics1 = _GDIPlus_ImageGetGraphicsContext($hImage1)
_GDIPlus_GraphicsDrawImageRectRect($hGraphics1, $hImage, $iSrcX, $iSrcY, $iSrcW, $iSrcH, $iDstX, $iDstY, $iDstW, $iDstH)
;_GDIPlus_ImageSaveToFile($hImage1, $sOutPic)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($hGraphics1)
_GDIPlus_ImageDispose($hImage)
;_GDIPlus_ImageDispose($hImage1)
_GDIPlus_Shutdown()
Return $hImage1
EndFunc ;==>_ImageRectToFile
图片资源 |