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
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Color.au3>
Opt("GUIOnEventMode",1)
$titel = "Funkey's Style-Test"
$Form1 = GUICreate($titel, 400, 600, -1, -1, $WS_POPUP)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUISetBkColor(0x00ADDC)
_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')
$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')
;~ $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)
_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)
$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')
GUISetState(@SW_SHOW, $Form1)
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(10000)
WEnd
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
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
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
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)
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
Func _Exit()
Sleep(100)
Exit
EndFunc