GDI+: Gui transparent wegen transparenter GDI+ Grafik

  • Hallo,

    irgendwie schaffe ich es nicht das meine Grafik die ich mit GDI+ gemacht habe halbwegs transparent wird und man das Spielfeld durscheinend sieht. Also die Gui soll zu 100 % transparent sein, damit die Grafik auch transparent ist. Nicht wundern, das wird nicht so bleiben, wird nur zum testen sein,weil ich nicht weiß wie groß das später wird, später wird es dann als PNG eingebunden.
    Achja Script starten und dann die Pause-Taste drücken, dann kommt das Fenster bzw. die Grafik. Die zuständige Funktion dafür heißt _MenuShow ;).

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    #include <Misc.au3>
    #Include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global $aEnableForGo[4] ; [links, oben, rechts, unten]
    Global $Timer[6], $Hold[4]
    Global $iCountPoints = 0
    Global $iGuiWidth = 600
    Global $iGuiHeight = 600
    Global $iX = 0
    Global $iY = 0
    Global $iAngleStart = 20
    Global $iAngleEnd = 320
    Global $piewidth = 0
    Global $pieheight = 320
    Global $aSquarePos[4]
    Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1], _
    [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], _
    [0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1], _
    [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1], _
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1], _
    [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], _
    [1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1], _
    [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]]

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

    ;~ Global $aBG[12][12] = [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], _
    ;~ [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0], _
    ;~ [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _
    ;~ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

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

    Global $aPoints = $aBG

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

    HotKeySet("{PAUSE}", "_MenuShow")

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

    $hDLL = DllOpen("user32.dll")

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

    $hGui = GUICreate("PacMan made by m-obi", $iGuiWidth, $iGuiHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()

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

    _GDIPlus_Startup ()

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

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGuiWidth, $iGuiHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    $pac = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    $Brush1 = _GDIPlus_BrushCreateSolid(0xFFEEEEEE)
    $Brush2 = _GDIPlus_BrushCreateSolid(0xFF000000)
    $Brush3 = _GDIPlus_BrushCreateSolid(0xFF636363)
    $Brush_Red = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    $Brush_Green = _GDIPlus_BrushCreateSolid(0xFF00FF00)
    _SquarePos()
    _BG()
    _DrawPoints()

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

    AdlibRegister("_SquarePos", 50)
    AdlibRegister("_AniPacMan", 400)

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

    While 1
    ;~ If _IsPressed("13", $hDLL) Then
    ;~ While 1
    ;~ If Not _IsPressed("13", $hDLL) Then
    ;~ _Time("stop")
    ;~ _MenuShow()
    ;~ ExitLoop
    ;~ EndIf
    ;~ WEnd
    ;~ EndIf
    ;ConsoleWrite(@CRLF & TimerDiff($Timer[0]))
    _CheckPoints()

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

    If TimerDiff($Timer[1]) > 200 Then _Draw(1)

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

    ;ToolTip($aSquarePos[0] & @CRLF & $aSquarePos[1] & @CRLF & $aSquarePos[2] & @CRLF & $aSquarePos[3])

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

    If $aSquarePos[0] > 0.9 Then $aEnableForGo[0] = $aBG[Int($aSquarePos[1])][Int($aSquarePos[0]) - 1]
    If $aSquarePos[1] > 0.9 Then $aEnableForGo[1] = $aBG[Int($aSquarePos[1]) - 1][Int($aSquarePos[0])]
    If $aSquarePos[0] < 11 Then $aEnableForGo[2] = $aBG[Int($aSquarePos[1])][Int($aSquarePos[0]) + 1]
    If $aSquarePos[1] < 11 Then $aEnableForGo[3] = $aBG[Int($aSquarePos[1]) + 1][Int($aSquarePos[0])]

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

    _SquarePos()

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

    $aEnableForGo[0] = _Iif($aSquarePos[0] = 0.5 Or (Not $aEnableForGo[0] And StringRight($aSquarePos[0], 1) = 5), 0, 1)
    $aEnableForGo[1] = _Iif($aSquarePos[1] = 0.5 Or (Not $aEnableForGo[1] And StringRight($aSquarePos[1], 1) = 5), 0, 1)
    $aEnableForGo[2] = _Iif($aSquarePos[0] = 11.5 Or (Not $aEnableForGo[2] And StringRight($aSquarePos[0], 1) = 5), 0, 1)
    $aEnableForGo[3] = _Iif($aSquarePos[1] = 11.5 Or (Not $aEnableForGo[3] And StringRight($aSquarePos[1], 1) = 5), 0, 1)

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

    If Not _IsPressed("25", $hDLL) Then $Hold[0] = 0
    If Not _IsPressed("26", $hDLL) Then $Hold[1] = 0
    If Not _IsPressed("27", $hDLL) Then $Hold[2] = 0
    If Not _IsPressed("28", $hDLL) Then $Hold[3] = 0

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

    If StringRight($aSquarePos[0], 1) = 5 Then
    Select
    Case _IsPressed("26", $hDLL) And $aEnableForGo[1] ;oben
    _Time("start")
    If Not $Hold[1] Then $Timer[3] = TimerInit()
    $Hold[1] = 1
    $iAngleStart = 290
    $iY -= 10
    _Draw()
    While _IsPressed("26", $hDLL) And TimerDiff($Timer[3]) < 300
    Sleep(10)
    WEnd
    Case _IsPressed("28", $hDLL) And $aEnableForGo[3] ;unten
    _Time("start")
    If Not $Hold[3] Then $Timer[5] = TimerInit()
    $Hold[3] = 1
    $iAngleStart = 110
    $iY += 10
    _Draw()
    While _IsPressed("28", $hDLL) And TimerDiff($Timer[5]) < 300
    Sleep(10)
    WEnd
    EndSelect
    EndIf

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

    _SquarePos()

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

    If StringRight($aSquarePos[1], 1) = 5 Then
    Select
    Case _IsPressed("25", $hDLL) And $aEnableForGo[0] ;links
    _Time("start")
    If Not $Hold[0] Then $Timer[2] = TimerInit()
    $Hold[0] = 1
    $iAngleStart = 200
    $iX -= 10
    _Draw()
    While _IsPressed("25", $hDLL) And TimerDiff($Timer[2]) < 300
    Sleep(10)
    WEnd
    Case _IsPressed("27", $hDLL) And $aEnableForGo[2] ;rechts
    _Time("start")
    If Not $Hold[2] Then $Timer[4] = TimerInit()
    $Hold[2] = 1
    $iAngleStart = 20
    $iX += 10
    _Draw()
    While _IsPressed("27", $hDLL) And TimerDiff($Timer[4]) < 300
    Sleep(10)
    WEnd
    EndSelect
    EndIf
    WEnd

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

    Func _Draw($iTyp = 0)
    AdlibUnRegister("_SquarePos")
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 0)
    _GDIPlus_GraphicsFillRect($hBuffer, Int($aSquarePos[0]) * 50, Int($aSquarePos[1]) * 50, 50, 50, $Brush1)
    _GDIPlus_GraphicsFillRect($hBuffer, Int($aSquarePos[2]) * 50, Int($aSquarePos[3]) * 50, 50, 50, $Brush1)
    If StringRight($aSquarePos[0], 1) = 5 And StringRight($aSquarePos[1], 1) = 5 And $aPoints[Int($aSquarePos[1])][Int($aSquarePos[0])] Then
    $aPoints[Int($aSquarePos[1])][Int($aSquarePos[0])] = 0
    $iCountPoints -= 1
    EndIf
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    If $aPoints[Int($aSquarePos[1])][Int($aSquarePos[0])] Then _GDIPlus_GraphicsFillEllipse($hBuffer, Int($aSquarePos[0]) * 50 + 15, Int($aSquarePos[1]) * 50 + 15, 20, 20, $Brush3)
    If $aPoints[Int($aSquarePos[3])][Int($aSquarePos[2])] Then _GDIPlus_GraphicsFillEllipse($hBuffer, Int($aSquarePos[2]) * 50 + 15, Int($aSquarePos[3]) * 50 + 15, 20, 20, $Brush3)
    AdlibRegister("_SquarePos", 50)
    While 1
    Switch $iTyp
    Case 0
    $iTyp = _Iif(TimerDiff($Timer[1]) > 200, 1, 2)
    Case 1
    _GDIPlus_GraphicsFillPie($hBuffer, $iX + 2, $iY + 2, 46, 46, $iAngleStart, $iAngleEnd, $pac)
    ExitLoop
    Case 2
    _GDIPlus_GraphicsFillPie($hBuffer, $iX + 2, $iY + 2, 46, 46, $iAngleStart - 15, $iAngleEnd + 30, $pac)
    ExitLoop
    EndSwitch
    WEnd
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 0)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGuiWidth, $iGuiHeight)
    EndFunc

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

    Func _DrawPoints()
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    If StringRight($aSquarePos[0], 1) = 5 And StringRight($aSquarePos[1], 1) = 5 Then $aPoints[Int($aSquarePos[1])][Int($aSquarePos[0])] = 0
    For $y = 0 To UBound($aPoints) - 1
    For $x = 0 To UBound($aPoints, 2) - 1
    If $aPoints[$y][$x] Then
    _GDIPlus_GraphicsFillEllipse($hBuffer, $x * 50 + 15, $y * 50 + 15, 20, 20, $Brush3)
    $iCountPoints += 1
    EndIf
    Next
    Next
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 0)
    EndFunc

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

    Func _AniPacMan()
    _Draw(2)
    $Timer[1] = TimerInit()
    EndFunc

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

    Func _BG()
    _GDIPlus_GraphicsFillRect($hBuffer, 0, 0, 600, 600, $Brush2)
    For $y = 0 To UBound($aBG) - 1
    For $x = 0 To UBound($aBG, 2) - 1
    If $aBG[$y][$x] Then _GDIPlus_GraphicsFillRect($hBuffer, $x * 50, $y * 50, 50, 50, $Brush1)
    Next
    Next
    EndFunc

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

    Func _SquarePos()
    $aSquarePos[0] = ($iX / 50) + 0.5
    $aSquarePos[1] = ($iY / 50) + 0.5
    Select
    Case StringRight($aSquarePos[0], 1) = 5 And StringRight($aSquarePos[1], 1) = 5
    $aSquarePos[2] = $aSquarePos[0]
    $aSquarePos[3] = $aSquarePos[1]
    Case StringRight($aSquarePos[0], 1) < 5 And StringRight($aSquarePos[1], 1) = 5
    $aSquarePos[2] = $aSquarePos[0] - 1
    $aSquarePos[3] = $aSquarePos[1]
    Case StringRight($aSquarePos[0], 1) = 5 And StringRight($aSquarePos[1], 1) < 5
    $aSquarePos[2] = $aSquarePos[0]
    $aSquarePos[3] = $aSquarePos[1] - 1
    Case StringRight($aSquarePos[0], 1) > 5 And StringRight($aSquarePos[1], 1) = 5
    $aSquarePos[2] = $aSquarePos[0] + 1
    $aSquarePos[3] = $aSquarePos[1]
    Case StringRight($aSquarePos[0], 1) = 5 And StringRight($aSquarePos[1], 1) > 5
    $aSquarePos[2] = $aSquarePos[0]
    $aSquarePos[3] = $aSquarePos[1] + 1
    EndSelect
    EndFunc

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

    Func _CheckPoints()
    If $iCountPoints = 0 Then
    MsgBox(0, "Test", "Test")
    EndIf
    EndFunc

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

    Func _Time($sCommand)
    Local Static $iTime
    Switch $sCommand
    Case "start"
    If $Timer[0] = "" Then $Timer[0] = TimerInit()
    Case "stop"
    If $Timer[0] <> "" Then
    $iTime += TimerDiff($Timer[0])
    $Timer[0] = ""
    Return $iTime
    EndIf
    EndSwitch
    EndFunc

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

    Func _MenuShow()
    _Time("stop")
    HotKeySet("{PAUSE}")

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

    Local $iWidth = 200
    Local $iHeight = 300
    Local $iRadius = 30
    Local $iOffset = 3

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

    GUISetState(@SW_DISABLE, $hGui)
    Opt("GUIOnEventMode", 0)
    $hGuiMenu = GUICreate("Menü", $iWidth + 6, $iHeight + 6, Default, Default, $WS_POPUP, Default, $hGui)
    $hContinue = GUICtrlCreateButton("Weiter", 40, 40, 80, 25)
    GUISetState()
    $hGraphicMenu = _GDIPlus_GraphicsCreateFromHWND($hGuiMenu)
    $hBitmapMenu = _GDIPlus_BitmapCreateFromGraphics($iWidth + 6, $iHeight + 6, $hGraphicMenu)
    $hBufferMenu = _GDIPlus_ImageGetGraphicsContext($hBitmapMenu)
    $Brush_BG = _GDIPlus_BrushCreateSolid(0xAAFFA500)
    $Pen_BG_Line = _GDIPlus_PenCreate(0xFF000000, 3)
    $Pen_BG_Arc = _GDIPlus_PenCreate(0xFF000000, 3)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iWidth - $iRadius + $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iHeight - $iRadius + $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iRadius + $iOffset, $iWidth - $iRadius * 2, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 2)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iOffset, $iHeight - $iRadius + $iOffset, $iOffset, $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius + $iOffset, $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iWidth + $iOffset, $iRadius + $iOffset, $iWidth + $iOffset, $iHeight - $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iHeight + $iOffset, $iWidth - $iRadius + $iOffset, $iHeight + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 0)
    _GDIPlus_GraphicsDrawImageRect($hGraphicMenu, $hBitmapMenu, 0, 0, $iWidth + 6, $iHeight + 6)

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

    While 1
    Switch GUIGetMsg()
    Case $hContinue
    GUISetState(@SW_ENABLE, $hGui)
    GUIDelete($hGuiMenu)
    Opt("GUIOnEventMode", 1)
    HotKeySet("{PAUSE}", "_MenuShow")
    _Time("start")
    Return
    EndSwitch
    WEnd
    EndFunc

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

    Func _Exit()
    _GDIPlus_BrushDispose($pac)
    _GDIPlus_BrushDispose($Brush1)
    _GDIPlus_BrushDispose($Brush2)
    _GDIPlus_BrushDispose($Brush3)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    DllClose($hDLL)
    Exit
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von m-obi (7. Mai 2010 um 23:29)

  • Füge in der Funktion _MenuShow() _WinAPI_SetLayeredWindowAttributes($hGuiMenu, 0xf0f0f0) ein.

    [autoit]


    ...
    $hGuiMenu = GUICreate("Menü", $iWidth + 6, $iHeight + 6, Default, Default, $WS_POPUP, $WS_EX_LAYERED, $hGui)
    $hContinue = GUICtrlCreateButton("Weiter", 40, 40, 80, 25)
    _WinAPI_SetLayeredWindowAttributes($hGuiMenu, 0xf0f0f0)
    GUISetState()
    ...

    [/autoit]

    Dann sollte die GUI transparent sein.

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Achja genau ich hatte $WS_EX_LAYERED vergessen, hatte es nämlich schon ausprobiert.^^
    Gut jetzt ist die GUI nicht mehr sichtbar. Jetzt fehlt nur noch das GDI+ so transparent ist wie es im Brush beschrieben ist. Das einzigste ist, dass er die Farbe blasser macht, aber nicht transparent.

  • Sollte mit dieser Funktion sollte es so funktionieren, wie du es willst oder?

    [autoit]


    ...
    Func _MenuShow()
    _Time("stop")
    HotKeySet("{PAUSE}")

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

    Local $iWidth = 200
    Local $iHeight = 300
    Local $iRadius = 30
    Local $iOffset = 3

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

    GUISetState(@SW_DISABLE, $hGui)
    Opt("GUIOnEventMode", 0)

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

    $hGuiMenu = GUICreate("Menü", $iWidth + 6, $iHeight + 6, -1, -1, 0, $WS_EX_LAYERED)
    $hGuiMenu1 = GUICreate("", 80, 25, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST, $hGuiMenu)
    GUISetBkColor(0xF0F0F0)
    $hContinue = GUICtrlCreateButton("Weiter", 0, 0, 80, 25)

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

    GUISetState(@SW_SHOW, $hGuiMenu1)
    GUISetState(@SW_SHOW, $hGuiMenu)

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

    _WinAPI_SetLayeredWindowAttributes($hGuiMenu1, 0xF0F0F0)
    WinSetTrans ($hGuiMenu1, "", 0xC0)
    $hGraphicMenu = _GDIPlus_GraphicsCreateFromHWND($hGuiMenu)
    $hBitmapMenu = _GDIPlus_BitmapCreateFromGraphics($iWidth + 6, $iHeight + 6, $hGraphicMenu)
    $hBufferMenu = _GDIPlus_ImageGetGraphicsContext($hBitmapMenu)

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

    #region
    $ScreenDc = _WinAPI_GetDC($hGuiMenu)
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapMenu)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)
    _WinAPI_SelectObject($dc, $gdibitmap)
    ; _WinAPI_UpdateLayeredWindow parameters
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $iWidth + 6)
    DllStructSetData($tSize, "Y", $iHeight + 6)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 0xF0)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $Brush_BG = _GDIPlus_BrushCreateSolid(0xAAFFA500)
    $Pen_BG_Line = _GDIPlus_PenCreate(0xFF000000, 3)
    $Pen_BG_Arc = _GDIPlus_PenCreate(0xFF000000, 3)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iWidth - $iRadius + $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iHeight - $iRadius + $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iRadius + $iOffset, $iWidth - $iRadius * 2, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 2)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iOffset, $iHeight - $iRadius + $iOffset, $iOffset, $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius + $iOffset, $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iWidth + $iOffset, $iRadius + $iOffset, $iWidth + $iOffset, $iHeight - $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iHeight + $iOffset, $iWidth - $iRadius + $iOffset, $iHeight + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 2)

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

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapMenu)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hGuiMenu, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)

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

    ;~ _GDIPlus_GraphicsDrawImageRect($hGraphicMenu, $hBitmapMenu, 0, 0, $iWidth + 6, $iHeight + 6)
    #endregion

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

    While 1
    Switch GUIGetMsg()
    Case $hContinue
    _GDIPlus_PenDispose($Pen_BG_Line)
    _GDIPlus_PenDispose($Pen_BG_Arc)
    _GDIPlus_BrushDispose($Brush_BG)
    _WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hGuiMenu, $ScreenDc)
    _GDIPlus_GraphicsDispose($hBufferMenu)
    _GDIPlus_BitmapDispose($hBitmapMenu)
    $tSize = ""
    $tSource = ""
    $tBlend = ""
    $tPoint = ""
    GUISetState(@SW_ENABLE, $hGui)
    GUIDelete($hGuiMenu)
    GUIDelete($hGuiMenu1)
    Opt("GUIOnEventMode", 1)
    HotKeySet("{PAUSE}", "_MenuShow")
    _Time("start")
    Return
    EndSwitch
    WEnd
    EndFunc
    ...

    [/autoit]


    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    Einmal editiert, zuletzt von UEZ (7. Mai 2010 um 22:08)

  • UEZ du bist einfach der Beste :thumbup:, genau so wie ich es wollte. Ich glaube da mach ich doch lieber kein PNG extra um den Code zu sparen, dann las ich das lieber auch per GDI+ machen, sowie im restlichen Script.

    Edit: Könntest du mir noch ein paar Kommi's hinter den Befehlen schreiben :S:rolleyes: , dann weiß ich für was die zuständig sind. Für später, da wird statt dem Button ein GDI+ Button hinkommen und noch ein paar Mehrere.

    Einmal editiert, zuletzt von m-obi (7. Mai 2010 um 23:34)

  • Spoiler anzeigen
    [autoit]


    Func _MenuShow()
    _Time("stop")
    HotKeySet("{PAUSE}")

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

    Local $iWidth = 200
    Local $iHeight = 300
    Local $iRadius = 30
    Local $iOffset = 3

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

    GUISetState(@SW_DISABLE, $hGui)
    Opt("GUIOnEventMode", 0)

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

    $hGuiMenu = GUICreate("Menü", $iWidth + 6, $iHeight + 6, -1, -1, 0, $WS_EX_LAYERED)
    $hGuiMenu1 = GUICreate("", 80, 25, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST, $hGuiMenu)
    GUISetBkColor(0xF0F0F0)
    $hContinue = GUICtrlCreateButton("Weiter", 0, 0, 80, 25)

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

    GUISetState(@SW_SHOW, $hGuiMenu1)
    GUISetState(@SW_SHOW, $hGuiMenu)

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

    _WinAPI_SetLayeredWindowAttributes($hGuiMenu1, 0xF0F0F0);Guifarbe transparent machen
    WinSetTrans ($hGuiMenu1, "", 0xC0);gui transparent machen
    $hGraphicMenu = _GDIPlus_GraphicsCreateFromHWND($hGuiMenu)
    $hBitmapMenu = _GDIPlus_BitmapCreateFromGraphics($iWidth + 6, $iHeight + 6, $hGraphicMenu);bild laden und zum zeichnen berait machen:
    $hBufferMenu = _GDIPlus_ImageGetGraphicsContext($hBitmapMenu)

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

    #region
    $ScreenDc = _WinAPI_GetDC($hGuiMenu);hDC von GUI
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapMenu);zurecht schaffen
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)
    _WinAPI_SelectObject($dc, $gdibitmap) ;auswählen? :D
    ; _WinAPI_UpdateLayeredWindow parameters
    $tSize = DllStructCreate($tagSIZE) ;Neue HBmitmap in Speicher schreiben:...
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $iWidth + 6)
    DllStructSetData($tSize, "Y", $iHeight + 6)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 0xF0)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $Brush_BG = _GDIPlus_BrushCreateSolid(0xAAFFA500);zeichnen vorbereiten
    $Pen_BG_Line = _GDIPlus_PenCreate(0xFF000000, 3)
    $Pen_BG_Arc = _GDIPlus_PenCreate(0xFF000000, 3)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iWidth - $iRadius + $iOffset, $iRadius + $iOffset, $iRadius, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iHeight - $iRadius + $iOffset, $iWidth - $iRadius * 2, $iRadius, $Brush_BG)
    _GDIPlus_GraphicsFillPie($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Brush_BG)
    _GDIPlus_GraphicsFillRect($hBufferMenu, $iRadius + $iOffset, $iRadius + $iOffset, $iWidth - $iRadius * 2, $iHeight - $iRadius * 2, $Brush_BG)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 2)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iOffset, $iHeight - $iRadius + $iOffset, $iOffset, $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 180, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iOffset, $iWidth - $iRadius + $iOffset, $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iOffset, $iRadius * 2, $iRadius * 2, 270, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iWidth + $iOffset, $iRadius + $iOffset, $iWidth + $iOffset, $iHeight - $iRadius + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iWidth - $iRadius * 2 + $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 0, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsDrawLine($hBufferMenu, $iRadius + $iOffset, $iHeight + $iOffset, $iWidth - $iRadius + $iOffset, $iHeight + $iOffset, $Pen_BG_Line)
    _GDIPlus_GraphicsDrawArc($hBufferMenu, $iOffset, $iHeight - $iRadius * 2 + $iOffset, $iRadius * 2, $iRadius * 2, 90, 90, $Pen_BG_Arc)
    _GDIPlus_GraphicsSetSmoothingMode($hBufferMenu, 2)

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

    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapMenu)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hGuiMenu, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)

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

    ;~ _GDIPlus_GraphicsDrawImageRect($hGraphicMenu, $hBitmapMenu, 0, 0, $iWidth + 6, $iHeight + 6)
    #endregion

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

    While 1
    Switch GUIGetMsg()
    Case $hContinue
    _GDIPlus_PenDispose($Pen_BG_Line)
    _GDIPlus_PenDispose($Pen_BG_Arc)
    _GDIPlus_BrushDispose($Brush_BG)
    _WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hGuiMenu, $ScreenDc)
    _GDIPlus_GraphicsDispose($hBufferMenu)
    _GDIPlus_BitmapDispose($hBitmapMenu)
    $tSize = ""
    $tSource = ""
    $tBlend = ""
    $tPoint = ""
    GUISetState(@SW_ENABLE, $hGui)
    GUIDelete($hGuiMenu)
    GUIDelete($hGuiMenu1)
    Opt("GUIOnEventMode", 1)
    HotKeySet("{PAUSE}", "_MenuShow")
    _Time("start")
    Return
    EndSwitch
    WEnd
    EndFunc

    [/autoit]


    Ich weiß aber nicht ob dir das hilft und ob es 100% richtig ist :rolleyes: