• Was haltet ihr von meiner Version für runde Buttons?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode",1)

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

    $Form1 = GUICreate("Funkey's Test mit runden Buttons", 400, 800, -1, -1);,$WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")

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

    _GuiRoundCorners($Form1, 0, 0, 40, 40)

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

    GUISetState(@SW_SHOW, $Form1)
    $Button1 = _GuiCreateRoundButton($Form1, 170, 150, 60, 150, '_Button', 0xFF0000)
    GUICtrlCreatePic(@DocumentsCommonDir&'\Eigene Bilder\Beispielbilder\Winter.jpg', 0, 0, 60, 150, 0)
    $Button2 = _GuiCreateRoundButton($Form1, 120, 350, 160, 50, '_Button', 0xFFFF00)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 450, 100, 100, '_Button', 0x00FF00)
    GUICtrlCreatePic(@DocumentsCommonDir&'\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 0, 0, 100, 100, 0)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Button()
    Switch @GUI_WinHandle
    Case $Button1
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc

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

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor)
    Local $ret, $ret2, $nExStyle, $Button
    $Button = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, $WS_CHILD, -1, $hWndParent)
    GUISetOnEvent($GUI_EVENT_PRIMARYUP, $sFunc)
    GUISetCursor(0, 1, $Button)
    GUISetBkColor($iColor, $Button)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $Button, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    GUISetState()
    Return $Button
    Else
    Return SetError(1, 0, 0)
    EndIf
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]

    Edit: GUISetCursor(0, 1, $Button) eingefügt
    Edit2: noch überflüssige Zeilen entfernt

  • Stimmt natürlich. Die Funktion für die Gui habe ich mir bei deinem Post abgeguckt und dann hatte ich eine Idee und hab's jetzt weiterentwickelt für Child-Guis. Sieht doch toll aus, oder? :D Und man braucht sich nicht um Transparenz oder ähnliches zu kümmern. Das kann man aber sicher noch weiterentwickeln. Man kann jedes jpg oder bmp verwenden oder einfach nur eine Farbe angeben! Also mir gefällt's sehr gut! :P

    • Offizieller Beitrag

    funkey du hast in deiner 1. Post ein ] hinter Autoit vergessen, deshalb werden der Source nicht richtig angezeigt ;)

  • Hab die Funktion erweitert, bin aber noch nicht ganz zufrieden. Ich musste das Label deaktivieren, damit der Klick registriert wird, außerdem geht nur entweder Bild oder Text gleichzeitig

    Spoiler anzeigen
    [autoit]

    #include <StaticConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode",1)

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

    $title = "Funkey's Test mit runden Buttons"
    $Form1 = GUICreate($title, 400, 800, -1, -1,$WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
    GUISetBkColor(0x0)
    _GuiRoundCorners($Form1, 0, 0, 400, 400)

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

    GUICtrlCreateLabel($title, 0, 100, 400, 30, 0x0201)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1, 15, 1000)

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

    $Button1 = _GuiCreateRoundButton($Form1, 170, 150, 60, 150, '_Button', 0x202020, '', -1, @DocumentsCommonDir&'\Eigene Bilder\Beispielbilder\Winter.jpg')
    $Button2 = _GuiCreateRoundButton($Form1, 120, 350, 160, 50, '_Button', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 450, 100, 100, '_Button', 0x00FF00, 'bla', -1, @DocumentsCommonDir&'\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg')

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

    GUISetState(@SW_SHOW, $Form1)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Button()
    Switch @GUI_WinHandle
    Case $Button1
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc

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

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor = -1, $sText = "", $iTextSize = -1, $sFileBg = "")
    Local $ret, $ret2, $nExStyle, $Button
    If $iColor = -1 Then $iColor = 0xD4D0C8
    If $iTextSize = -1 Then $iTextSize = 10
    $Button = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, $WS_CHILD, -1, $hWndParent)
    GUISetOnEvent($GUI_EVENT_PRIMARYUP, $sFunc)
    GUISetCursor(0, 1, $Button)
    GUISetBkColor($iColor, $Button)
    If $sFileBg <> "" Then GUICtrlCreatePic($sFileBg, 0, 0, $iWidth, $iHeight, 0, 0x00000020)
    If $sText <> "" And $sText <> -1 Then
    GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x0201, 0x00000008)
    GUICtrlSetFont(-1, $iTextSize, 1000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    EndIf
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $Button, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    GUISetState()
    Return $Button
    Else
    Return SetError(1, 0, 0)
    EndIf
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]
  • Ich hab es jetzt so gemacht:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    Dim $Button[2],$Icon[2]
    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\Hendrik\Favoriten\Eigene Dateien\AutoIt\Übungen\XSkin\Oberfläche\XSkin.kxf
    $Titel = "INC"
    $Form2 = GUICreate($Titel, 555, 532, 303, 219,$WS_POPUP)
    GUISetBkColor (0x00FF00)
    $Pic1 = GUICtrlCreatePic(@ScriptDir & "\Data\1.bmp", 0, 0, 555, 532, $WS_CLIPSIBLINGS)
    $Label1 = GUICtrlCreateLabel(" "& $Titel, 0, 0, 555, 32,$WS_EX_TRANSPARENT, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor (-1,$GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor (-1,0xFF0A000)
    GUICtrlSetFont (-1,12,550,0,"Arial")
    $Button[0] = GUICreate("", 16, 16, 525, 3, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Form2);
    $Icon[0] = GUICtrlCreatePic(@ScriptDir & "\Data\X.gif",0, 0, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
    $Button[1] = GUICreate("", 16, 16, 500, 3, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $Form2);
    $Icon[1] = GUICtrlCreatePic(@ScriptDir & "\Data\_.gif",0, 0, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form2, "int", 400, "long", 0x00040010);Slide von unten ein
    GUISetState(@SW_SHOW,$Button[0])
    GUISetState(@SW_SHOW,$Button[1])
    GUISetState(@SW_SHOW,$Form2)
    #EndRegion ### END Koda GUI section ###
    Dim $Pfad[2][2],$Status[2]
    $Pfad[0][0] = @ScriptDir & "\Data\X.gif"
    $Pfad[0][1] = @ScriptDir & "\Data\X1.gif"
    $Pfad[1][0] = @ScriptDir & "\Data\_.gif"
    $Pfad[1][1] = @ScriptDir & "\Data\_1.gif"
    $Status[0] = False
    $Status[1] = False
    _Ecken($Form2,0,0,10,10)
    Sleep (100)
    While 1
    $iOldOpt = Opt("MouseCoordMode", 2)
    $aPos = MouseGetPos()
    $aPos3 = WinGetPos($Form2)
    For $A = 0 To 1
    $aPos2 = WinGetPos($Button[$A])
    If IsArray ($aPos2) Then
    $Point = _PointInEllipse($aPos[0], $aPos[1],$aPos2[0] - $aPos3[0] , $aPos2[1] - $aPos3[1], 16, 16)
    _Pic($Icon[$A],$A)
    EndIf
    Next
    Opt("MouseCoordMode", $iOldOpt)
    $MSG = GUIGetMsg (1)
    Switch $MSG[1]
    Case $Button[0]
    GUIDelete ($Button[0])
    GUIDelete ($Button[1])
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form2, "int", 400, "long", 0x00050010);Slide nach unten aus
    Exit
    Case $Button[1]
    GUISetState(@SW_MINIMIZE)
    EndSwitch
    WEnd
    Func _Ecken($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Local $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
    $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
    EndFunc ;==>_GuiRoundCorners
    Func _PointInEllipse($xPt, $yPt, $xTL, $yTL, $w, $h)
    Local $bInside = False, $a = $w / 2, $b = $h / 2
    Local $c1X, $c2X, $dist, $xc = $xTL + $a, $yc = $yTL + $b
    $c1X = $xc - ($a ^ 2 - $b ^ 2) ^ (1 / 2); 1st focal point x position
    $c2X = $xc + ($a ^ 2 - $b ^ 2) ^ (1 / 2); 2nd focal point x position
    $dist = (($xPt - $c1X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5 + (($xPt - $c2X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5
    If $dist <= $w Then $bInside = Not $bInside
    Return $bInside
    EndFunc ;==>_PointInEllipse
    Func _Pic($hHandel,$Zahl)
    If $Status[$Zahl] <> $Point Then
    $Status[$Zahl] = $Point
    If $Status[$Zahl] = True Then
    GUICtrlSetImage ($hHandel,$Pfad[$Zahl][1])
    ElseIf $Status[$Zahl] = False Then
    GUICtrlSetImage ($hHandel,$Pfad[$Zahl][0])
    EndIf
    EndIf
    EndFunc

    [/autoit]


    Ich mach nochmal Alles in ein Rar

    EDIT:
    War noch ein Fehler drin, hab ich jetzt behoben!

    mfg. Jam00

    Einmal editiert, zuletzt von Jam00 (6. Februar 2009 um 17:40)

  • kannst du mal aufhörn alle threads, die was mit deinen problemen zu tun haben, vollzuspamen?
    das geht mir mittlerweile echt aufn keks (bin mir sicher dass ich net der einzige bin)
    und jetzt hast nicht mal ne fehlerbeschreibung dabei...
    ich hab jez echt kein bock des runterzuladen
    sorry aber des musst jez ma sein^^

    Padmak

  • Hab die Funktion für die 'runden Buttons' jetzt noch erweitert bzw. kombiniert mit Farbübergängen!

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Color.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $titel = "Funkey's Style-Test"
    Global $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor(0xFFFFFF)

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

    _GuiRoundCorners($Form1, 0, 0, 50, 50)

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

    $Min_Label = GUICtrlCreateLabel("-", 305, 5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 24, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xAAAAAA)
    GUICtrlSetTip(-1, 'Minimieren')
    GUICtrlSetOnEvent(-1, '_Minimize')

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

    $Close_Label = GUICtrlCreateLabel("×", 328, 5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 14, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xAAAAAA)
    GUICtrlSetTip(-1, 'Schließen')
    GUICtrlSetOnEvent(-1, '_Exit')

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

    $Titel_Label = GUICtrlCreateLabel($titel, 0, 0, 400, 30, 0x4000201, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xffffff)

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

    _CreateColorTransition(100, 0, 100, 30, 0xFFFFFF, 0x000000, 1)
    _CreateColorTransition(200, 0, 100, 30, 0x000000, 0xFFFFFF, 1)
    _CreateColorTransition(0, 0, 50, 600, 0x000000, 0xffffff, 1)
    _CreateColorTransition(350, 0, 50, 600, 0xFFFFFF, 0x000000, 1)

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

    $Button1 = _GuiCreateRoundButton($Form1, 170, 100, 60, 150, '_Button', 0x202020, '', -1, @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg')
    $Button2 = _GuiCreateRoundButton($Form1, 120, 300, 160, 50, '_Button', 0x000000, 'Testbutton', 15)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 100, 100, '_Button', 0xFF0FFFF, 'Button', 15, @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg')

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

    Global $aChildGuis[3][2] = [[$Button1[0], $Button1[1]],[$Button2[0], $Button2[1]],[$Button3[0], $Button3[1]]]
    Global $HoverFound[UBound($aChildGuis, 1)]

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

    GUISetState(@SW_SHOW, $Form1)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Button()
    Switch @GUI_CtrlId
    Case $Button1[1]
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2[1]
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3[1]
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc ;==>_Button

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

    Func _Minimize()
    Sleep(100)
    GUISetState(@SW_MINIMIZE)
    EndFunc ;==>_Minimize

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

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor = -1, $sText = "", $iTextSize = -1, $sFileBg1 = "", $sFileBg2 = "")
    Local $ret, $ret2, $Button[2]
    If $iColor = -1 Then $iColor = 0x000000
    If $iTextSize = -1 Then $iTextSize = 10
    $Button[0] = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, $WS_CHILD, -1, $hWndParent)
    ;~ GUISetOnEvent($GUI_EVENT_PRIMARYUP, $sFunc, $Button[0])
    GUISetCursor(0, 1)
    If $sFileBg1 = "" Then
    _CreateColorTransition(0, 0, $iWidth / 2, $iHeight, $iColor, 0xFFFFFF, 1)
    _CreateColorTransition($iWidth / 2, 0, $iWidth / 2, $iHeight, 0xFFFFFF, $iColor, 1)
    EndIf

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

    If $sFileBg1 <> "" Then $Button[1] = GUICtrlCreatePic($sFileBg1, 0, 0, $iWidth, $iHeight, 0)
    $Button[1] = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x0201);, 0x00000008)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, $iColor)
    GUICtrlSetFont(-1, $iTextSize, 1000)
    GUICtrlSetOnEvent(-1, $sFunc)
    _GuiMakeRound($Button[0], $iWidth, $iHeight)
    GUISetState()
    Return $Button
    EndFunc ;==>_GuiCreateRoundButton

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

    Func _GuiMakeRound($hWnd, $iWidth, $iHeight)
    Local $ret, $ret2
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Else
    Return SetError(1, 0, 0)
    EndIf
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_GuiMakeRound

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc ;==>_GuiRoundCorners

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

    Func _CreateColorTransition($iPosx, $iPosy, $iWidth, $iHeight, $nColorStart, $nColorEnd, $iAlignment = 0)
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau
    $startRot = _ColorGetRed($nColorStart)
    $startGruen = _ColorGetGreen($nColorStart)
    $startBlau = _ColorGetBlue($nColorStart)
    $endRot = _ColorGetRed($nColorEnd)
    $endGruen = _ColorGetGreen($nColorEnd)
    $endBlau = _ColorGetBlue($nColorEnd)

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

    GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)

    Switch $iAlignment
    Case 0
    $ColorOffsetRot = ($endRot - $startRot) / $iHeight
    $ColorOffsetGruen = ($endGruen - $startGruen) / $iHeight
    $ColorOffsetBlau = ($endBlau - $startBlau) / $iHeight
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    Case Else
    $ColorOffsetRot = ($endRot - $startRot) / $iWidth
    $ColorOffsetGruen = ($endGruen - $startGruen) / $iWidth
    $ColorOffsetBlau = ($endBlau - $startBlau) / $iWidth
    For $i = 0 To $iWidth - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    EndSwitch
    EndFunc ;==>_CreateColorTransition

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

    Func _Exit()
    Sleep(100)
    Exit
    EndFunc ;==>_Exit

    [/autoit]
  • Hab noch die Verwendung als Hoverbutton vereinfacht!

    Spoiler anzeigen
    [autoit]

    #include <File.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Color.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $titel = "Funkey's Style-Test"
    Global $Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor(0xFFFFFF)

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

    _GuiRoundCorners($Form1, 0, 0, 50, 50)

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

    $Min_Label = GUICtrlCreateLabel("-", 305, 5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 24, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xAAAAAA)
    GUICtrlSetTip(-1, 'Minimieren')
    GUICtrlSetOnEvent(-1, '_Minimize')

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

    $Close_Label = GUICtrlCreateLabel("×", 328, 5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 14, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xAAAAAA)
    GUICtrlSetTip(-1, 'Schließen')
    GUICtrlSetOnEvent(-1, '_Exit')

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

    $Titel_Label = GUICtrlCreateLabel($titel, 0, 0, 400, 30, 0x4000201, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xffffff)

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

    _CreateColorTransition(50, 0, 300, 30, 0xFFFFFF, 0x000000, 1, 2)
    _CreateColorTransition(0, 0, 50, 600, 0x000000, 0xD4D0C8, 0, 2)
    _CreateColorTransition(350, 0, 50, 600, 0xD4D0C8, 0x000000, 0, 2)

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

    $Button1 = _GuiCreateRoundButton($Form1, 170, 100, 60, 150, '_Button', 0xFF5500, @CR & '|' & @CR, 20, 0, 2);, @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg')
    $Button2 = _GuiCreateRoundButton($Form1, 120, 300, 160, 50, '_Button', 0x567890, '', 15, 0, 10)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 100, 100, '_Button', 0xFFFFFF, 'Button 3', 15, 1, -1, @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg')

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

    GUICtrlSetColor($Button2[1], 0x0)
    GUISetState(@SW_SHOW, $Form1)
    Global $HoverStatus[3]
    AdlibEnable('_Hover', 50)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _Button()
    Switch @GUI_CtrlId
    Case $Button1[1]
    MsgBox(0, "Runder Button", "Button 1 wurde gedrückt")
    Case $Button2[1]
    MsgBox(0, "Runder Button", "Button 2 wurde gedrückt")
    Case $Button3[1]
    MsgBox(0, "Runder Button", "Button 3 wurde gedrückt")
    EndSwitch
    EndFunc ;==>_Button

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

    Func _Minimize()
    Sleep(100)
    GUISetState(@SW_MINIMIZE)
    EndFunc ;==>_Minimize

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

    Func _Hover()
    Local $HoverInfo
    If MouseGetCursor() = 0 Then
    $HoverInfo = GUIGetCursorInfo()
    If Not IsArray($HoverInfo) Then Return
    Switch $HoverInfo[4]
    Case $Button1[1]
    If $HoverStatus[0] = 0 Then GUICtrlSetFont($Button1[1], 30, 1000)
    $HoverStatus[0] = 1
    Case $Button2[1]
    If $HoverStatus[1] = 0 Then
    GUICtrlSetFont($Button2[1], 20, 1000)
    GUICtrlSetData($Button2[1], 'Testbutton')
    EndIf
    $HoverStatus[1] = 1
    Case $Button3[1]
    If $HoverStatus[2] = 0 Then GUICtrlSetImage($Button3[2], @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Winter.jpg')
    $HoverStatus[2] = 1
    EndSwitch
    Else
    If $HoverStatus[0] = 1 Then GUICtrlSetFont($Button1[1], 20, 1000)
    $HoverStatus[0] = 0
    If $HoverStatus[1] = 1 Then
    GUICtrlSetFont($Button2[1], 15, 1000)
    GUICtrlSetData($Button2[1], '')
    EndIf
    $HoverStatus[1] = 0
    If $HoverStatus[2] = 1 Then GUICtrlSetImage($Button3[2], @DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg')
    $HoverStatus[2] = 0
    EndIf
    EndFunc ;==>_Hover

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

    Func _GuiCreateRoundButton($hWndParent, $iPosx, $iPosy, $iWidth, $iHeight, $sFunc, $iColor = -1, $sText = "", $iTextSize = -1, $iAlignment = 1, $iWaveFaktor = -1, $sFileBg = "")
    Local $ret, $ret2, $Button[3]
    If $iColor = -1 Then $iColor = 0x000000
    If $iTextSize = -1 Then $iTextSize = 10
    If $iWaveFaktor = -1 Or (Mod($iWaveFaktor, 2) = 1 And $iWaveFaktor <> 1) Or $iWaveFaktor > 12 Then $iWaveFaktor = 2
    $Button[0] = GUICreate("", $iWidth, $iHeight, $iPosx, $iPosy, $WS_CHILD, -1, $hWndParent)
    GUISetCursor(0, 1)
    If $sFileBg <> "" Then
    $Button[2] = GUICtrlCreatePic($sFileBg, 0, 0, $iWidth, $iHeight, 0)
    Else
    $Button[2] = _CreateColorTransition(0, 0, $iWidth, $iHeight, $iColor, 0xFFFFFF, $iAlignment, $iWaveFaktor)
    EndIf
    $Button[1] = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, 0x00000301, 0x00000008)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, $iColor)
    GUICtrlSetFont(-1, $iTextSize, 1000)
    GUICtrlSetOnEvent(-1, $sFunc)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', 0, 'long', 0, 'long', $iWidth, 'long', $iHeight, 'long', $iHeight, 'long', $iWidth)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $Button[0], 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Else
    SetError(1)
    EndIf
    Else
    SetError(2)
    EndIf
    GUISetState()
    Return $Button
    EndFunc ;==>_GuiCreateRoundButton

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc ;==>_GuiRoundCorners

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

    Func _CreateColorTransition($iPosx, $iPosy, $iWidth, $iHeight, $nColorStart, $nColorEnd, $iAlignment = 0, $iWaveFaktor = 1)
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau, $Grafik
    $startRot = _ColorGetRed($nColorStart)
    $startGruen = _ColorGetGreen($nColorStart)
    $startBlau = _ColorGetBlue($nColorStart)
    $endRot = _ColorGetRed($nColorEnd)
    $endGruen = _ColorGetGreen($nColorEnd)
    $endBlau = _ColorGetBlue($nColorEnd)
    $Grafik = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $iHeight += $iWaveFaktor - Mod($iHeight, $iWaveFaktor)
    Switch $iAlignment
    Case 0
    $ColorOffsetRot = ($endRot - $startRot) / ($iHeight / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iHeight / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iHeight / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iHeight / $iWaveFaktor) To ($w) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iHeight / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    For $i = $w * ($iHeight / $iWaveFaktor) To ($w + 1) * ($iHeight / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iHeight / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    Case Else
    $ColorOffsetRot = ($endRot - $startRot) / ($iWidth / $iWaveFaktor)
    $ColorOffsetGruen = ($endGruen - $startGruen) / ($iWidth / $iWaveFaktor)
    $ColorOffsetBlau = ($endBlau - $startBlau) / ($iWidth / $iWaveFaktor)
    Switch Mod($iWaveFaktor, 2)
    Case 0
    For $w = 1 To $iWaveFaktor - 1 Step 2
    For $i = ($w - 1) * ($iWidth / $iWaveFaktor) To ($w) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1 - (($w - 1) * $iWidth / $iWaveFaktor)), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    For $i = $w * ($iWidth / $iWaveFaktor) To ($w + 1) * ($iWidth / $iWaveFaktor) - 1
    $Color = '0x' & Hex($endRot - $ColorOffsetRot * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endGruen - $ColorOffsetGruen * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2) & _
    Hex($endBlau - $ColorOffsetBlau * ($i - ($w * $iWidth / $iWaveFaktor) + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $iHeight)
    Next
    Next
    Case 1
    For $i = 0 To $iHeight - 1
    $Color = '0x' & Hex($startRot + $ColorOffsetRot * ($i + 1), 2) & _
    Hex($startGruen + $ColorOffsetGruen * ($i + 1), 2) & _
    Hex($startBlau + $ColorOffsetBlau * ($i + 1), 2)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $i)
    Next
    EndSwitch
    EndSwitch
    Return $Grafik
    EndFunc ;==>_CreateColorTransition

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

    Func _Exit()
    Sleep(100)
    Exit
    EndFunc ;==>_Exit

    [/autoit]