Png Im png drehen

  • Hallo


    Ich habe ein Bild
    was stehen soll aber das 2 soll sich hinterm 1 drehen beide
    Bilder sind Png Bilder auch Transparent aber wie bekomme ich das hin
    also das sich das 2 bild um 360 dreht^^
    und habe da noch eine frage wie bekomme ich das hin das ich ein PNG Bild als GUI Benutze
    aber wenn ich auf freie stellen vom bild klicke also wo kein button u.s.w ist das ich das verschieben kan das bild oder ehre alles ^^ also mit buttons u.s.w ^^

    könnte mir da jemand Hilfe Stellung geben ^^

  • und habe da noch eine frage wie bekomme ich das hin das ich ein PNG Bild als GUI Benutze
    aber wenn ich auf freie stellen vom bild klicke also wo kein button u.s.w ist das ich das verschieben kan das bild oder ehre alles ^^ also mit buttons u.s.w ^^

    http://www.autoitscript.com/forum/index.php?showtopic=102961

  • Dann lad doch einfach mal beide Bilder hoch, so kann man besser testen. ;)
    Hier mal ein Beispiel für das drehen eines PNGs in einem anderen PNG.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("Test", 400, 400)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics(400, 400, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $hImageBG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\BG.png")
    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Image.png")

    [/autoit] [autoit][/autoit] [autoit]

    $iX = 50
    $iY = 50
    $iWidth = 100
    $iHeight = 100
    $iAngle = 0
    $iRotationSpeed = 2

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(20)
    $iAngle += $iRotationSpeed
    _GDIPlus_GraphicsClear($hBuffer, 0xFFFFFFFF)
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImageBG, 0, 0, 400, 400)

    _GDIPlus_GraphicsTranslateTransform($hBuffer, $iX + $iWidth / 2, $iY + $iHeight / 2)
    _GDIPlus_GraphicsRotateTransform($hBuffer, $iAngle)

    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage, -$iWidth / 2, -$iHeight/ 2, $iWidth, $iHeight)

    _GDIPlus_GraphicsResetTransform($hBuffer)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, 400, 400)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImageBG)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsRotateTransform
    ; Description ...: Updates the world transformation matrix of a Graphics object with the product of itself and a rotation matrix
    ; Syntax.........: _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle[, $iOrder = 0])
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $nAngle - The angle, in degrees, of rotation
    ; $iOrder - Order of matrices multiplication:
    ; |0 - The rotation matrix is on the left
    ; |1 - The rotation matrix is on the right
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: _GDIPlus_GraphicsMultiplyTransform
    ; Link ..........; @@MsdnLink@@ GdipRotateWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle, $iOrder = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipRotateWorldTransform", "hwnd", $hGraphics, "float", $nAngle, "int", $iOrder)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsRotateTransform

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsResetTransform
    ; Description ...: Sets the world transformation matrix of a Graphics object to the identity matrix
    ; Syntax.........: _GDIPlus_GraphicsResetTransform($hGraphics)
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: None
    ; Link ..........; @@MsdnLink@@ GdipResetWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsResetTransform($hGraphics)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipResetWorldTransform", "hwnd", $hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsResetTransform

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsTranslateTransform
    ; Description ...: Updates a Graphics object's world transformation matrix with the product of itself and a translation matrix
    ; Syntax.........: _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY[, $iOrder = 0])
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $nDX - Horizontal component of the translation
    ; $nDY - Vertical component of the translation
    ; $iOrder - Order of matrices multiplication:
    ; |0 - The translation matrix is on the left
    ; |1 - The translation matrix is on the right
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: None
    ; Link ..........; @@MsdnLink@@ GdipTranslateWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY, $iOrder = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGraphics, "float", $nDX, "float", $nDY, "int", $iOrder)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsTranslateTransform

    [/autoit]


    Benötigte Bilder sind im Anhang. ;)

  • Hier, bitte, hab die Bilder auf 222x200 verkleinert.

    Spoiler anzeigen
    [autoit]

    #include<GDIPlus.au3>
    #include<WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)
    $hGUI = GUICreate("Rotate", 300, 300)
    GUISetOnEvent(-3, "_Exit")
    GUISetState()
    GUIRegisterMsg($WM_PAINT, "_WM_PAINT")

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics(222, 200, $hGraphics)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage1 = _GDIPlus_ImageLoadFromFile("lm_text.png")
    $hImage2 = _GDIPlus_ImageLoadFromFile("lm_notext.png")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    OnAutoItExitRegister("_Cleanup")

    [/autoit] [autoit][/autoit] [autoit]

    $iAngle = 360
    While 1
    $iAngle -= 5
    If $iAngle = 0 Then $iAngle = 360
    _GDIPlus_GraphicsClear($hBuffer, 0xFFFFFFFF)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsTranslateTransform($hBuffer, 100, 100)
    _GDIPlus_GraphicsRotateTransform($hBuffer, $iAngle)
    _GDIPlus_GraphicsTranslateTransform($hBuffer, -100, -100)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage1, 0, 0, 222, 200)
    _GDIPlus_GraphicsResetTransform($hBuffer)
    _GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage2, 0, 0, 222, 200)

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_INTERNALPAINT)
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _WM_PAINT()
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 20, 20, 222, 200)
    Return 'GUI_RUNDEFMSG'
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Exit
    EndFunc
    Func _Cleanup()
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _GDIPlus_Shutdown()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsRotateTransform
    ; Description ...: Updates the world transformation matrix of a Graphics object with the product of itself and a rotation matrix
    ; Syntax.........: _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle[, $iOrder = 0])
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $nAngle - The angle, in degrees, of rotation
    ; $iOrder - Order of matrices multiplication:
    ; |0 - The rotation matrix is on the left
    ; |1 - The rotation matrix is on the right
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: _GDIPlus_GraphicsMultiplyTransform
    ; Link ..........; @@MsdnLink@@ GdipRotateWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle, $iOrder = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipRotateWorldTransform", "hwnd", $hGraphics, "float", $nAngle, "int", $iOrder)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsRotateTransform

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsResetTransform
    ; Description ...: Sets the world transformation matrix of a Graphics object to the identity matrix
    ; Syntax.........: _GDIPlus_GraphicsResetTransform($hGraphics)
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: None
    ; Link ..........; @@MsdnLink@@ GdipResetWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsResetTransform($hGraphics)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipResetWorldTransform", "hwnd", $hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsResetTransform

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsTranslateTransform
    ; Description ...: Updates a Graphics object's world transformation matrix with the product of itself and a translation matrix
    ; Syntax.........: _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY[, $iOrder = 0])
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $nDX - Horizontal component of the translation
    ; $nDY - Vertical component of the translation
    ; $iOrder - Order of matrices multiplication:
    ; |0 - The translation matrix is on the left
    ; |1 - The translation matrix is on the right
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: None
    ; Related .......: None
    ; Link ..........; @@MsdnLink@@ GdipTranslateWorldTransform
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY, $iOrder = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGraphics, "float", $nDX, "float", $nDY, "int", $iOrder)

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsTranslateTransform

    [/autoit]
  • Das weiße Kästchen solltest du mit dem ExStyle $WS_EX_LAYERED wegbekommen.

    [autoit]


    GUICreate("GUI",-1,-1,-1,-1,$WS_POPUP,$WS_EX_LAYERED)

    [/autoit]

    Wenn du es nicht in der Taskleiste sehen möchtest könntest du zusätzlich noch den ExStyle $WS_Ex_toolwindow benützen

    [autoit]


    GUICreate("GUI",-1,-1,-1,-1,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_Ex_toolwindow))

    [/autoit]