Gui-Styling ohne Bilder (Farbübergänge)

  • Hab jetzt noch zusätzlich zu der 'Runde Buttons'-Funktion eine Funktion geschrieben, die mir Farbübergänge macht. Sieht eigentlich auch ganz toll aus.

    Spoiler anzeigen
    [autoit]

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

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

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

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

    _GuiRoundCorners($Form1, 0, 0, 20, 20)

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

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

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

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

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

    ;~ $Titel_Label = GUICtrlCreateLabel($titel, 0,0, 400, 30, 0x4457201, $GUI_WS_EX_PARENTDRAG)
    $Titel_Label = GUICtrlCreateLabel($titel, 0,0, 400, 20, 0x4000201, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetFont(-1, 12, 1000)
    GUICtrlSetBkColor(-1, 0x002CFA)
    GUICtrlSetColor(-1, 0xffffff)

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

    _CreateColorTransition(0, 20, 400, 15, 0x002CFA, 0x00ADDC)
    _CreateColorTransition(0, 550, 400, 50, 0x00ADDC, 0x002CFA)
    ;~ _CreateColorTransition(0, 50, 25, 485, 0x002CFA, 0x00ADDC, 1)
    ;~ _CreateColorTransition(375, 50, 25, 485, 0x00ADDC, 0x002CFA, 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', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 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 _Minimize()
    Sleep(100)
    GUISetState(@SW_MINIMIZE)
    EndFunc

    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 _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

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

    Func _Exit()
    Sleep(100)
    Exit
    EndFunc

    [/autoit]
    • Offizieller Beitrag

    Sieht gut aus, vorallem die Farbübergänge . :thumbup:

  • Danke! Hab jetzt noch das Titel-Label transparent gemacht. Sieht besser aus

    Spoiler anzeigen
    [autoit]

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

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

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

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

    _GuiRoundCorners($Form1, 0, 0, 20, 20)

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

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

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

    $Close_Label = GUICtrlCreateLabel("×", 368,5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 14, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xFFAAAA)
    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(0, 0, 400, 40, 0x002CFA, 0x00ADDC)
    _CreateColorTransition(0, 550, 400, 50, 0x00ADDC, 0xabcdef)
    ;~ _CreateColorTransition(0, 50, 25, 485, 0x002CFA, 0x00ADDC, 1)
    ;~ _CreateColorTransition(375, 50, 25, 485, 0x00ADDC, 0x002CFA, 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', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 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 _Minimize()
    Sleep(100)
    GUISetState(@SW_MINIMIZE)
    EndFunc

    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 _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

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

    Func _Exit()
    Sleep(100)
    Exit
    EndFunc

    [/autoit]
  • Muss auch sagen sieht toll aus, können sich sicher viele Damit anfreunden :thumbup: ( Ich in 2 jahren) :rofl:

    Was ich allerdings nicht verstehe, beim 2. Skript hast du das "Label" Transparent gemacht?
    Bei mir ist einfach der Übergang im Titel etwas heller/transparenter je nachdem...

  • Es sieht ja ziemlich gleich aus, aber so hat man viel mehr Möglichkeiten offen! ;)
    Siehe hier:

    Spoiler anzeigen
    [autoit]

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

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

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

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

    _GuiRoundCorners($Form1, 0, 0, 20, 20)

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

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

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

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

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

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

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

    _CreateColorTransition(0, 0, 400, 30, 0xFF0000, 0x0000FF, 1)
    _CreateColorTransition(0, 550, 400, 50, 0x00ADDC, 0xabcdef)

    [/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', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 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 _Minimize()
    Sleep(100)
    GUISetState(@SW_MINIMIZE)
    EndFunc

    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 _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

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

    Func _Exit()
    Sleep(100)
    Exit
    EndFunc

    [/autoit]
  • Okey, na dann :D

    Ist sicher Interessant, aber für mich als "Anfänger" ist das noch Zukunft ^^

  • Das ist doch eben auch für Anfänger eine leichte Sache solche Farbübergänge in die eingene Gui einzubauen. Deshalb habe ich ja diese Funktion geschrieben!

    Spoiler anzeigen
    [autoit]

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

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

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

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

    _GuiRoundCorners($Form1, 0, 0, 150, 150)

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

    $Min_Label = GUICtrlCreateLabel("-", 305, 5, 20, 20, 0x1201, $WS_EX_CLIENTEDGE)
    GUICtrlSetFont(-1, 24, 0)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetBkColor(-1, 0xFFAAAA)
    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, 0xFFAAAA)
    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(0, 0, 400, 30, 0x00FF00, 0x0000FF, 1)
    _CreateColorTransition(0, 550, 400, 50, 0x00ADDC, 0xabcdef)
    _CreateColorTransition(0, 0, 100, 600, 0x002CFA, 0x00ADDC, 1)
    _CreateColorTransition(300, 0, 100, 600, 0x00ADDC, 0xFF2CFA, 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', 0xFFFF00, 'Testbutton', 20)
    $Button3 = _GuiCreateRoundButton($Form1, 150, 400, 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 ;==>_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, $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 ;==>_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)
    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]
  • Okey, wenn du es sagst :D Für mich wirkt es einfach ein bisschen zu Ueberladen, zuviel auf einmal xD

    Was interessant wäre, wenn man den Buttons einen Hover Effekt geben könnte.
    Muss echt sagen, sieht geil aus :D

  • Hab mal wieder etwas gebastelt. Die Funktion '_GuiMakeTransitionBorder' zeichnet einen Fensterrahmen mit Farbübergängen.
    Wenn man die Rahmenbreite größer als die halbe Fensterbreite angibt, dann kommen z.T. schöne Muster raus (einfach deaktivierte Zeile aktivieren) ;)

    Spoiler anzeigen
    [autoit]

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

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

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

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

    _GuiRoundCorners($Form1, 0, 0, 30, 30)

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

    _GuiMakeTransitionBorder($Form1, 35, 0xaa00ff, 0xffffff)
    ;~ _GuiMakeTransitionBorder($Form1, 200, 0x123456, 0xf23456)
    ;~ _GuiMakeTransitionBorder($Form1, 300, 0x000000, 0xeeeeee)

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

    GUISetState(@SW_SHOW, $Form1)

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

    While 1
    Sleep(10000)
    WEnd

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

    Func _GuiMakeTransitionBorder($hwnd, $iSize, $nColor_out, $nColor_in)
    Local $Width, $Height, $aPos, $hGraphic
    Local $startRot, $startGruen, $startBlau, $endRot, $endGruen, $endBlau, $Color
    Local $ColorOffsetRot, $ColorOffsetGruen, $ColorOffsetBlau
    $aPos = WinGetPos($hwnd)
    $Width = $aPos[2]
    $Height = $aPos[3]
    $startRot = _ColorGetRed($nColor_out)
    $startGruen = _ColorGetGreen($nColor_out)
    $startBlau = _ColorGetBlue($nColor_out)
    $endRot = _ColorGetRed($nColor_in)
    $endGruen = _ColorGetGreen($nColor_in)
    $endBlau = _ColorGetBlue($nColor_in)
    $ColorOffsetRot = ($endRot - $startRot) / $iSize
    $ColorOffsetGruen = ($endGruen - $startGruen) / $iSize
    $ColorOffsetBlau = ($endBlau - $startBlau) / $iSize

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

    $hGraphic = GUICtrlCreateGraphic(0, 0, $Width, $Height, 0)
    For $i = 0 To $iSize - 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, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0 + $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i, $Height - $i - 1)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $i, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $i, $Height - $i)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $Color)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $Width - $i - 1, 0 + $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, $Width - $i - 1, $Height - $i)
    Next
    EndFunc ;==>_GuiMakeTransitionBorder

    [/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 _Exit()
    Exit
    EndFunc ;==>_Exit

    [/autoit]
    • Offizieller Beitrag

    Sieht richtig geil aus. 8):thumbup: