Was haltet ihr von meiner Version für runde Buttons?
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
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")
_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)
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 _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
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 _Exit()
Exit
EndFunc
Edit: GUISetCursor(0, 1, $Button) eingefügt
Edit2: noch überflüssige Zeilen entfernt