Lakes 242 Posted November 14, 2011 (edited) expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstants.au3> #include <GDIplus.au3> Global Const $width = 300 Global Const $height = 300 Global $title = "Draw Star" Global Const $nPI = 3.1415926535897932384626433832795 Global $iRadius = 125 ; Size of Star Global $iCenter = 150 ; Center of Star Global $Rad, $R, $hWin, $hPen, $D, $iD, $X1, $Y1, $iX, $iY, $n, $offset Global $Delay = 500 Opt("GUIOnEventMode", 1) $hwnd = GUICreate($title, $width, $height, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState() _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hwnd) ;Draw a Star just with lines, Change $Delay to change drawing speed $offset = 36 ; 36 = point at top, -36 to + 36 to rotate star DrawStar() msgbox(0,"", "Done") _GDIPlus_GraphicsClear($hGraphic ,0xFFd4d0c8) ;Rotate the Star For $Offset = -36 to 36 step 6 DrawStar() Sleep ($Delay) _GDIPlus_GraphicsClear($hGraphic ,0xFFd4d0c8) Next msgbox(0,"", "Done") ;Draw a Star Outline DrawStar2() While 1 Sleep(10) WEnd Func DrawStar() ;simple way to draw a star ; $offset = 36 ; 36 = point at top, -36 to + 36 to rotate star $start = $offset $Finsh = 360 + $offset $D = $start $R = ($nPI / 2) - ($D * ($nPI /180)) $X1 = Cos($R) * $iRadius + $iCenter $Y1 = Sin($R) * $iRadius + $iCenter _GDIPlus_GraphicsDrawEllipse($hGraphic, $X1 -2, $Y1 -2 , 4, 4, 0) For $D = $start to $Finsh * 2.5 step 144 $R = ($nPI / 2) - ($D * ($nPI /180)) $iX = Cos($R) * $iRadius + $iCenter $iY = Sin($R) * $iRadius + $iCenter _GDIPlus_GraphicsDrawLine($hGraphic, $X1, $Y1, $iX, $iY, 0) $X1 = $iX $Y1 = $iY Sleep($Delay) next EndFunc Func DrawStar2() ;Draw Star Outline _GDIPlus_GraphicsClear($hGraphic ,0xFFd4d0c8) Local $offset =36 Local $Points = 5 $iD = $offset $iR = ($nPI / 2) - ($iD * ($nPI /180)) ;Point at Top $iX = Cos($iR) * $iRadius + $iCenter $iY = Sin($iR) * $iRadius + $iCenter For $D = 0 to 360 - 360/$Points step 360/$Points ; Inner Point at bottom $R = ($nPI / 2) - ($D * ($nPI /180)) $X1 = Cos($R) * $iRadius/2.5 + $iCenter $Y1 = Sin($R) * $iRadius/2.5 + $iCenter _GDIPlus_GraphicsDrawString($hGraphic, $n, $X1 - 5, $Y1 - 5) _GDIPlus_GraphicsDrawLine ($hGraphic, $iX, $iY, $X1, $Y1) $n += 1 sleep($Delay) $iD = $D + $Offset $iR = ($nPI / 2) - ($iD * ($nPI /180)) $iX = Cos($iR) * $iRadius + $iCenter $iY = Sin($iR) * $iRadius + $iCenter ;_GDIPlus_GraphicsDrawEllipse($hGraphic, $iX -5, $iY -5 , 10, 10, 0) _GDIPlus_GraphicsDrawString($hGraphic, $n, $iX - 5, $iY -5) $n += 1 sleep($Delay) ;_GDIPlus_GraphicsDrawEllipse($hGraphic, $X1 -2, $Y1 -2, 4, 4) _GDIPlus_GraphicsDrawLine ($hGraphic, $X1, $Y1, $iX, $iY) Sleep($Delay) next $iD = 0 ;Draw line back to start point $R = ($nPI / 2) - ($D * ($nPI /180)) $X1 = Cos($R) * $iRadius/2.5 + $iCenter $Y1 = Sin($R) * $iRadius/2.5 + $iCenter _GDIPlus_GraphicsDrawLine ($hGraphic, $X1, $Y1, $iX, $iY) EndFunc Func close() _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_Shutdown () Exit EndFunc Edited November 14, 2011 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Share this post Link to post Share on other sites
guinness 1,519 Posted November 14, 2011 Nice example. When I first read the title I thought it was a question and not an example. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
Lakes 242 Posted November 14, 2011 Nice example. When I first read the title I thought it was a question and not an example.I`ve changed the title... 2015 - Still no flying cars, instead blankets with sleeves. Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted November 14, 2011 (edited) Forgot something? #include #include #include Edit:Pretty neat when fixed! Edited November 14, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
guinness 1,519 Posted November 14, 2011 That's the forum. When he edited his last post seems they were destroyed, the version I have was fine. I've noticed that when re-editing a post <Array.au3> turns to <array.au3> and a closing tag (</array.au3>) is appended to the end of the post. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
Lakes 242 Posted November 14, 2011 Fixed.... 2015 - Still no flying cars, instead blankets with sleeves. Share this post Link to post Share on other sites