本帖最后由 happytc 于 2012-8-9 18:40 编辑
lz 如果用gdi操作动画图像就不要用api,用api就不要用gdi,gdi操作的不是界面而是图像所处的环境,api操作的 ...
netegg 发表于 2012-8-9 02:58
这是什么道理呀?不明白!
我是被楼主的红色标题给吸过来的。接着又看见楼主发了源码,一般有源码的问题帖我都喜欢回
看看我写的代码能不能达到你的要求
#include <GDIPlus.au3>
#include <GDIP.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIEx.au3>
Local Const $STM_SETIMAGE = 0x0172
Local $hImage, $iWidth, $iHeight, $hContext, $hBmp, $hGui, $hPic
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\au3logo.png")
$iWidth = _GDIPlus_ImageGetWidth($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)
$hBitmap = _GDIPlus_BitmapCreateFromScan0(@DesktopWidth, @DesktopHeight)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsDrawImage($hContext, $hImage, (@DesktopWidth - $iWidth) / 2, (@DesktopHeight - $iHeight) / 2)
$hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
$hGui = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0x000000, $hGui)
$hPic = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight)
GUICtrlSetState($hPic, $GUI_DISABLE)
GUICtrlSendMsg($hPic, $STM_SETIMAGE, 0, $hBmp)
_WinAPI_DeleteObject($hPic)
_WinAPI_DeleteObject($hBmp)
_GDIPlus_Shutdown()
GUISetState(@SW_HIDE, $hGui)
_WinAPI_AnimateWindow($hGui, 0x40004, 1500)
_WinAPI_SetForegroundWindow($hGui)
While True
If GUIGetMsg() == -3 Then ExitLoop
WEnd
|