Erzeugt eine polygonische Region.
#include <WinAPIGdi.au3>
_WinAPI_CreatePolygonRgn ( Const ByRef $aPoint [, $iStart = 0 [, $iEnd = -1 [, $iMode = 1]]] )
$aPoint | Das 2D-Array ([x1, y1], [x2, y2], ... [xN, yN]) welche die Punkte des Polygons in logischen Einheiten beinhaltet. Das Polygon wird als geschlossen angenommen, jeder Punkt darf nur einmal angegeben werden. |
$iStart | [optional] Der Index des Arrays an dem das Erstellen beginnen soll. |
$iEnd | [optional] Der Index des Arrays an dem das Erstellen aufhören soll. |
$iMode | [optional] Der Füllmodus welcher entscheidet welche Pixel sich in der Region befinden. Dieser Parameter kann einen der folgenden Werte annehmen: $ALTERNATE (Standard) $WINDING |
Erfolg: | Das Handle zu der Region. |
Fehler: | 0. |
Wenn man das HRGN Objekt nicht länger benötigt, sollte man die _WinAPI_DeleteObject() Funktion aufrufen, um es zu löschen.
Suche nach CreatePolygonRgn in der MSDN Bibliothek.
#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 500, 475, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
Local $idButton = GUICtrlCreateButton('Exit', 215, 255, 70, 23)
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
GUISetBkColor(0xAA0000)
; Create polygonal region and set it to the window
Local $aPoint[10][2] = [[0, 180], [190, 180], [250, 0], [308, 180], [500, 180], [344, 294], [404, 475], [250, 362], [94, 475], [154, 294]]
Local $hRgn = _WinAPI_CreatePolygonRgn($aPoint)
_WinAPI_SetWindowRgn($hForm, $hRgn, 0)
GUISetState(@SW_SHOW)
Do
Until GUIGetMsg() = $idButton
Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam, $lParam
Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST