Andreik Posted July 14, 2011 Posted July 14, 2011 (edited) This is a nice example of window created from shapes using written by Authenticity.expandcollapse popup#include-once #include <GDIPlus.au3> #include <GDIP.au3> Global $HEAD[5] = ["Ellipse",0,0,399,399] Global $EYE_LEFT[5] = ["Ellipse",75,100,50,50] Global $EYE_RIGHT[5] = ["Ellipse",275,100,50,50] Global $NOSE_POINTS[6][2] = [[5,0],[200,150],[185,200],[200,250],[215,200],[200,150]] Global $NOSE[2] = ["Polygon",$NOSE_POINTS] Global $MOUTH[9] = ["Bezier",100,300,150,350,250,350,300,300] Global $TOOTH_LEFT[5] = ["Rectangle",175,300,20,20] Global $TOOTH_RIGHT[5] = ["Rectangle",205,300,20,20] Global $SHAPES[8] = [7,$HEAD,$EYE_LEFT,$EYE_RIGHT,$NOSE,$MOUTH,$TOOTH_LEFT,$TOOTH_RIGHT] $GUI = CreateWindowFromShapes("Example",400,400,$SHAPES) GUISetBkColor(0x000080,$GUI) GUISetState(@SW_SHOW,$GUI) While True Switch GUIGetMsg() Case -3 Exit Case -7 _SendMessage($GUI,0x0112,0xF012,0) EndSwitch Sleep(10) WEnd Func CreateWindowFromShapes($sTitle,$iWidth,$iHeight,$aShape) Local $aCurrentShape _GDIPlus_Startup() Local $hWnd = GUICreate($sTitle,$iWidth,$iHeight,Default,Default,0x80000000) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) Local $hPath = _GDIPlus_PathCreate() If IsArray($aShape) Then For $iIndex = 1 To $aShape[0] If IsArray($aShape[$iIndex]) Then $aCurrentShape = $aShape[$iIndex] Switch $aCurrentShape[0] Case "Ellipse" _GDIPlus_PathAddEllipse($hPath,$aCurrentShape[1],$aCurrentShape[2],$aCurrentShape[3],$aCurrentShape[4]) Case "Pie" _GDIPlus_PathAddPie($hPath,$aCurrentShape[1],$aCurrentShape[2],$aCurrentShape[3],$aCurrentShape[4],$aCurrentShape[5],$aCurrentShape[6]) Case "Polygon" _GDIPlus_PathAddPolygon($hPath,$aCurrentShape[1]) Case "Rectangle" _GDIPlus_PathAddRectangle($hPath,$aCurrentShape[1],$aCurrentShape[2],$aCurrentShape[3],$aCurrentShape[4]) Case "Bezier" _GDIPlus_PathAddBezier($hPath,$aCurrentShape[1],$aCurrentShape[2],$aCurrentShape[3],$aCurrentShape[4],$aCurrentShape[5],$aCurrentShape[6],$aCurrentShape[7],$aCurrentShape[8]) EndSwitch EndIf Next EndIf Local $pRegion = _GDIPlus_RegionCreateFromPath($hPath) Local $hRegion = _GDIPlus_RegionGetHRgn($pRegion,$hGraphics) DllCall("user32.dll","long","SetWindowRgn","hwnd",$hWnd,"hwnd",$hRegion,"int",1) _GDIPlus_PathDispose($hPath) _GDIPlus_RegionDispose($pRegion) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Return $hWnd EndFuncEnjoy! Edited July 14, 2011 by Andreik
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now