Jump to content

Math Magic


CoePSX
 Share

Recommended Posts

I was playing around with Sin and Cos, and i started to get patterns of mousemoves when changing

the value multiplied by the number before calculate Sin and Cos.

I'm not sure why this happens, I only know it's fun!.

Just test it and you'll see the magic of this. I even made it draw in CorelDraw and the details were

amazing.

#NoTrayIcon
#include <GUIConstants.au3>
#include <Constants.au3>

If $CmdLine[0] > 0 Then
    $CommandLine = StringLeft($CmdLine[1], 2)
Else
    $CommandLine = "/c"
EndIf

Global $DetailsLevel = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "DetailsLevel")
If $DetailsLevel = "" Then
    $DetailsLevel = 3
EndIf
Global $Delay = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "Delay")
If $Delay = "" Then
    $Delay = 30
EndIf
Global $WaitTime = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "WaitTime")
If $WaitTime = "" Then
    $WaitTime = 2
EndIf
Global $Cursor = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "Cursor")
If $Cursor = "" Then
    $Cursor = 1
EndIf
Global $MultiColor = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "MultiColor")
If $MultiColor = "" Then
    $MultiColor = 0
EndIf
Global $Gradient = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "Gradient")
If $Gradient = "" Then
    $Gradient = 1
EndIf

Global Const $Pi = 3.1415926535897932384626433832795
Global $IncreaseSize = (360/($DetailsLevel*90)) * (@DesktopWidth/1000)
Global $MaxTimes = ($DetailsLevel * 90)
Global $Pos = MouseGetPos()

If $CommandLine = "/c" Then
    $GUI = GuiCreate("MathMagic Screensaver Options", 250, 175, -1, -1, $WS_CAPTION)
    GuiCtrlCreateLabel("Details level:", 10, 13, 100, 20)
    $DetailsSlider = GuiCtrlCreateSlider(120, 5, 120, 30)
    
    GuiCtrlCreateLabel("Drawing speed:", 10, 45, 100, 25)
    $SpeedSlider = GuiCtrlCreateSlider(120, 40, 120, 30)
    
    GuiCtrlCreateLabel("Time between draws:", 10, 75, 100, 25)
    $WaitSlider = GuiCtrlCreateSlider(120, 70, 120, 30)
    
    $CursorCheck = GUICtrlCreateCheckbox("Show pencil", 15, 115, 85, 15)
    $ColorCheck = GUICtrlCreateCheckbox("2 colors", 100, 115, 55, 15)
    $GradientCheck = GUICtrlCreateCheckbox("Gradient", 165, 115, 65, 15)
    
    $OK = GuiCtrlCreateButton("OK", 10, 135, 90, 30)
    $Cancel = GuiCtrlCreateButton("Cancel", 160, 135, 80, 30)
    $About = GuiCtrlCreateButton("About", 100, 135, 60, 30)
    
    GUICtrlSetData($DetailsSlider, $DetailsLevel)
    GUICtrlSetData($SpeedSlider, (500 - $Delay) / 10)
    GUICtrlSetData($WaitSlider, $WaitTime)
    GUICtrlSetLimit($DetailsSlider, 10, 1)
    GUICtrlSetLimit($SpeedSlider, 50, 1)
    GUICtrlSetLimit($WaitSlider, 10, 0)
    GUICtrlSetState($CursorCheck, $Cursor)
    GUICtrlSetState($ColorCheck, $MultiColor)
    GUICtrlSetState($GradientCheck, $Gradient)
    GuiSetState()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Cancel
                Exit
            Case $About
                MsgBox(64, "Sobre", "MathMagic Screensaver" & @CRLF & @CRLF & "2006 - CoePSX")
            Case $OK
                $DetailsLevel = GUICtrlRead($DetailsSlider)
                $Delay = 500 - GUICtrlRead($SpeedSlider)*10
                $WaitTime = GUICtrlRead($WaitSlider)
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "DetailsLevel", "REG_SZ", $DetailsLevel)
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "Delay", "REG_SZ", $Delay)
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "WaitTime", "REG_SZ", $WaitTime)
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "Cursor", "REG_SZ", GUICtrlRead($CursorCheck))
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "MultiColor", "REG_SZ", GUICtrlRead($ColorCheck))
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "Gradient", "REG_SZ", GUICtrlRead($GradientCheck))
                Exit
        EndSwitch
    WEnd
ElseIf $CommandLine = "/s" Then
    $Window = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $Label = GUICtrlCreateLabel("", 20, 20, 60, 30)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetFont($Label, 18, 400)
    $Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
    $Pointer = GUICtrlCreateLabel("", @DesktopWidth, @DesktopHeight, 6, 6)
    GUICtrlSetBkColor($Pointer, 0xFFFFFF)
    GUISetBkColor(0)
    GUISetCursor(16, 1)
    GUISetState()

    Opt("ColorMode", 1)
    Opt("GUIOnEventMode", 1)
    GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Quit")
    $GDI32 = DllOpen("gdi32.dll")
    $USER32 = DllOpen("user32.dll")
    
    While GUIGetMsg() <> $GUI_EVENT_CLOSE
        $PicSize = 1
        $iNumber = Random(1, 360, 1)
        Dim $OldCoord[2]
        $OldCoord[0] = @DesktopWidth/2
        $OldCoord[1] = @DesktopHeight/2
        
        $Color1 = ColorGradient(RandomColor(), RandomColor(), $MaxTimes+1)
        $Color2 = ColorGradient(RandomColor(), RandomColor(), $MaxTimes+1)
        
        GUICtrlSetColor($Label, $Color1[0])
        GUICtrlSetData($Label, $iNumber)
        
        For $R = 1 To $MaxTimes
            $PicSize += $IncreaseSize
            
            $X = Sin($iNumber * ($R*($Pi/180))) * $PicSize + @DesktopWidth/2
            $Y= Cos($iNumber * ($R*($Pi/180))) * $PicSize + @DesktopHeight/2
            
            If $MultiColor = 1 Then
                If Mod($R, 2) = 0 Then
                    If $Gradient = 1 Then
                        $Color = $Color1[$R]
                    Else
                        $Color = $Color1[0]
                    EndIf
                Else
                    If $Gradient = 1 Then
                        $Color = $Color2[$R]
                    Else
                        $Color = $Color2[0]
                    EndIf
                EndIf
            Else
                If $Gradient = 1 Then
                    $Color = $Color1[$R]
                Else
                    $Color = $Color1[0]
                EndIf
            EndIf
            
            If $Cursor = 1 Then GUICtrlSetPos($Pointer, $X-3, $Y-3)
            $GUIHDC = DllCall ($USER32,"int","GetDC","hwnd", $Window)
            $Pen = DllCall($GDI32, "hwnd", "CreatePen", "int", "0", "int", "0", "hwnd", $Color)
            DllCall($GDI32, "hwnd", "SelectObject", "hwnd", $GUIHDC[0], "hwnd", $Pen[0])
            DllCall ($GDI32, "int", "MoveToEx", "hwnd", $GUIHDC[0], "int", $OldCoord[0], "int", $OldCoord[1], "ptr", 0)
            DllCall ($GDI32, "int", "LineTo", "hwnd", $GUIHDC[0], "int", $X, "int", $Y)
            DllCall ($USER32,"int","ReleaseDC","int",$GUIHDC[0],"hwnd",$Window)
                        
            $OldCoord[0] = $X
            $OldCoord[1] = $Y
            Sleep($Delay)
        Next
        
        Sleep($WaitTime*1000)
        GUICtrlDelete($Graphic)
        $Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
    WEnd
EndIf

Func Quit()
    Exit
EndFunc
Func ColorGradient($hInitialColor, $hFinalColor, $iReturnSize)
    $hInitialColor = Hex($hInitialColor, 6)
    $hFinalColor = Hex($hFinalColor, 6)
    
    Local $iRed1 = Dec (StringLeft($hInitialColor, 2))
    Local $iGreen1 = Dec (StringMid($hInitialColor, 3, 2))
    Local $iBlue1 = Dec (StringMid($hInitialColor, 5, 2))
    
    Local $iRed2 = Dec (StringLeft($hFinalColor, 2))
    Local $iGreen2 = Dec (StringMid($hFinalColor, 3, 2))
    Local $iBlue2 = Dec (StringMid($hFinalColor, 5, 2))
    
    Local $iPlusRed = ($iRed2-$iRed1)/($iReturnSize-1)
    Local $iPlusBlue = ($iBlue2-$iBlue1)/($iReturnSize-1)
    Local $iPlusGreen = ($iGreen2-$iGreen1)/($iReturnSize-1)
    
    Dim $iColorArray[$iReturnSize]
    For $i = 0 To $iReturnSize-1
        $iNowRed = Floor($iRed1 + ($iPlusRed*$i))
        $iNowBlue = Floor($iBlue1 + ($iPlusBlue*$i))
        $iNowGreen = Floor($iGreen1 + ($iPlusGreen*$i))
        $iColorArray[$i] = Dec (Hex($iNowRed, 2) & Hex($iNowGreen, 2) & Hex($iNowBlue, 2))
    Next
    Return ($iColorArray)
EndFunc
Func RandomColor($hMinColor = 0x000000, $hMaxColor = 0xFFFFFF)
    $hMinColor = Hex($hMinColor, 6)
    $hMaxColor = Hex($hMaxColor, 6)
    
    Local $iRed1 = Dec (StringLeft($hMinColor, 2))
    Local $iGreen1 = Dec (StringMid($hMinColor, 3, 2))
    Local $iBlue1 = Dec (StringMid($hMinColor, 5, 2))
    
    Local $iRed2 = Dec (StringLeft($hMaxColor, 2))
    Local $iGreen2 = Dec (StringMid($hMaxColor, 3, 2))
    Local $iBlue2 = Dec (StringMid($hMaxColor, 5, 2))
    
    Local $iRndRed = Random($iRed1, $iRed2, 1)
    Local $iRndGreen = Random($iGreen1, $iGreen2, 1)
    Local $iRndBlue = Random($iBlue1, $iBlue2, 1)
    
    Return Dec (Hex($iRndRed, 2) & Hex($iRndGreen, 2) & Hex($iRndBlue, 2))
EndFunc

:whistle: It looks like magic!

Compiled .SCR file with source code in the zip file.

MathMagicSCR.zip

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Makes a nice pattern

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Wow this is very nice :F

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
Share on other sites

just amazing :whistle:

anyone clue why this happens this way?

especially i wanna know why these circles come at the 5th painting, when $iNUmber is 6, while at all other Numbers there noticable corners

Edited by imbatmo
Link to comment
Share on other sites

Math is very amazing. Fractal art is really cool looking.

where do you see a fractal?

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Yeh I admit my knowledge of fractals is sparse, but thats got no fractal in it.

In colloquial usage, it denotes a shape that is recursively constructed or self-similar, that is, a shape that appears similar at all scales of magnification and is therefore often referred to as "infinitely complex."

Link to comment
Share on other sites

Apparently it has got something to do with transcedental numbers

http://en.wikipedia.org/wiki/Transcendental_number

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

:whistle: Icekirby1 that was a great idea!

Here's the first attempt on a screensaver.

$DetailsLevel and $Delay are the configuration variables

#NoTrayIcon
#include <GUIConstants.au3>
#include <Constants.au3>

Global Const $DetailsLevel = 3
Global Const $Delay = 30

Global Const $IncreaseSize = (360/($DetailsLevel*90)) * (@DesktopWidth/1000)
Global Const $MaxTimes = ($DetailsLevel * 90)
Global Const $Pos = MouseGetPos()

$Window = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Label = GUICtrlCreateLabel("", 20, 20, 60, 30)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont($Label, 18, 400)
$Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
GUISetBkColor(0)
GUISetCursor(16, 1)
GUISetState()

Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Quit")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    $PicSize = 1
    $iNumber = Random(2, 11, 1)
    $Color = "0x" & Hex(Random(150, 255, 1) & Random(150, 255, 1) & Random(150, 255, 1), 6)
    GUICtrlSetColor($Label, $Color)
    GUICtrlSetData($Label, $iNumber)
    Dim $OldCoord[2]
    $OldCoord[0] = @DesktopWidth/2
    $OldCoord[1] = @DesktopHeight/2
    For $R = 1 To $MaxTimes
        $PicSize += $IncreaseSize
        $X = Sin($R * $iNumber) * $PicSize + @DesktopWidth/2
        $Y= Cos($R * $iNumber) * $PicSize + @DesktopHeight/2
        GUICtrlSetGraphic($Graphic,$GUI_GR_MOVE, $OldCoord[0], $OldCoord[1])
        GUICtrlSetGraphic($Graphic,$GUI_GR_COLOR, $Color)
        GUICtrlSetGraphic($Graphic,$GUI_GR_LINE, $X, $Y)
        GUICtrlSetGraphic($Graphic,$GUI_GR_REFRESH)
        $OldCoord[0] = $X
        $OldCoord[1] = $Y
        Sleep($Delay)
    Next
    Sleep(2000)
    GUICtrlDelete($Graphic)
    $Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
WEnd

Func Quit()
    Exit
EndFunc

Is there a way to convert this to a scr?

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

Compile the script and rename it to .scr. If you add some command line parameter-checking

you could make it so that you can configurate it from the screensaver-settings. I think it's "/s"

for settings and "/p" for preview.

Link to comment
Share on other sites

This is really cool! Couple things that are just fascinating:

1. Change the Sine to a Tangent, not as neat, but fun anyway

2. use a different drawing tool... I found the circle to be amazing, and the spray paint can was really cool too.

I would love to make this a screensaver, not sure i have the mad autoit skillz to figure it out quite yet though... we'll see.

Link to comment
Share on other sites

Got it! :whistle:

It's now a (nearly) real screen saver.

I got the command-line stuff. /c = configure; /s = play

There's a zip file with the compiled .scr and the code attached.

Hope you like it.

CODE

#NoTrayIcon
#include <GUIConstants.au3>
#include <Constants.au3>

If $CmdLine[0] > 0 Then
    $CommandLine = StringLeft($CmdLine[1], 2)
Else
    $CommandLine = "/c"
EndIf

Global $DetailsLevel = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "DetailsLevel")
If $DetailsLevel = "" Then
    $DetailsLevel = 3
EndIf
Global $Delay = RegRead("HKEY_CURRENT_USER\Software\MathMagicSCR", "Delay")
If $Delay = "" Then
    $Delay = 30
EndIf
Global $IncreaseSize = (360/($DetailsLevel*90)) * (@DesktopWidth/1000)
Global $MaxTimes = ($DetailsLevel * 90)
Global $Pos = MouseGetPos()

If $CommandLine = "/c" Then
    $GUI = GuiCreate("MathMagic Screensaver Configuration", 250, 115, -1, -1, $WS_CAPTION)
    GuiCtrlCreateLabel("Details level:", 10, 13, 100, 20)
    $DetailsSlider = GuiCtrlCreateSlider(120, 5, 120, 30)
    GuiCtrlCreateLabel("Drawing speed:", 10, 48, 100, 20)
    $SpeedSlider = GuiCtrlCreateSlider(120, 40, 120, 30)
    $OK = GuiCtrlCreateButton("OK", 10, 75, 90, 30)
    $Cancel = GuiCtrlCreateButton("Cancel", 160, 75, 80, 30)
    $About = GuiCtrlCreateButton("About", 100, 75, 60, 30)
    GUICtrlSetData($DetailsSlider, $DetailsLevel)
    GUICtrlSetData($SpeedSlider, (500 - $Delay) / 10)
    GUICtrlSetLimit($DetailsSlider, 5, 1)
    GUICtrlSetLimit($SpeedSlider, 50, 1)
    GuiSetState()
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Cancel
                Exit
            Case $About
                MsgBox(64, "About", "MathMagic Screensaver" & @CRLF & @CRLF & "2006 - CoePSX")
            Case $OK
                $DetailsLevel = GUICtrlRead($DetailsSlider)
                $Delay = 500 - GUICtrlRead($SpeedSlider)*10
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "DetailsLevel", "REG_SZ", $DetailsLevel)
                RegWrite("HKEY_CURRENT_USER\Software\MathMagicSCR", "Delay", "REG_SZ", $Delay)
                Exit
        EndSwitch
    WEnd
ElseIf $CommandLine = "/s" Then
    $Window = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $Label = GUICtrlCreateLabel("", 20, 20, 60, 30)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetFont($Label, 18, 400)
    $Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
    GUISetBkColor(0)
    GUISetCursor(16, 1)
    GUISetState()

    Opt("GUIOnEventMode", 1)
    GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Quit")

    While GUIGetMsg() <> $GUI_EVENT_CLOSE
        $PicSize = 1
        $iNumber = Random(1, 360, 1)
        $Color = "0x" & Hex(Random(150, 255, 1) & Random(150, 255, 1) & Random(150, 255, 1), 6)
        GUICtrlSetColor($Label, $Color)
        GUICtrlSetData($Label, $iNumber)
        Dim $OldCoord[2]
        $OldCoord[0] = @DesktopWidth/2
        $OldCoord[1] = @DesktopHeight/2
        For $R = 1 To $MaxTimes
            $PicSize += $IncreaseSize
            $X = Sin($R * $iNumber) * $PicSize + @DesktopWidth/2
            $Y= Cos($R * $iNumber) * $PicSize + @DesktopHeight/2
            GUICtrlSetGraphic($Graphic,$GUI_GR_MOVE, $OldCoord[0], $OldCoord[1])
            GUICtrlSetGraphic($Graphic,$GUI_GR_COLOR, $Color)
            GUICtrlSetGraphic($Graphic,$GUI_GR_LINE, $X, $Y)
            GUICtrlSetGraphic($Graphic,$GUI_GR_REFRESH)
            $OldCoord[0] = $X
            $OldCoord[1] = $Y
            Sleep($Delay)
        Next
        Sleep(2000)
        GUICtrlDelete($Graphic)
        $Graphic = GUICtrlCreateGraphic(0, 0, @DesktopWidth, @DesktopHeight)
    WEnd
EndIf

Func Quit()
    Exit
EndFunc

MathMagicSCR.zip

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

Ok, this is messy and needs tidying up a lot, I`ve been too busy, so feel free to have a play with it!

Note the DLL drawing routine can be a little flaky so adjust the variables at your own risk, it does`nt do anything harmful, but you may need to refresh your desktop afterwards... ;)

Each drawing routine works on its own, just uncomment the one you want to see.

#include <GUIConstants.au3>
#include <Math.au3>

; == GUI generated with Koda ==);
$Graphics = GUICreate("Graphics", 592, 573, 192, 125, Bitor($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU,$WS_EX_TOPMOST))

$Prev = GUICtrlCreateButton("<< PREVIOUS", 8, 528, 89, 33, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Next = GUICtrlCreateButton("NEXT >>", 496, 528, 89, 33, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

Global $gdi_dll = DllOpen ("gdi32.dll"), $user32_dll = DllOpen ("user32.dll")
$Gh = GuiCtrlCreateGraphic(-1, -1, 600,600)

$Black  = "0x000000"
$White  = "0xFFFFFF"
$Red    = "0xFF0000"
$Green  = "0x00FF00"
$Blue   = "0x0000FF"
$Yellow = "0xFFFF00"

$XOrigin = 300
$YOrigin = 280

$Size = 280
$Wid = $Size
$Hgt = $Size

Dim $PenCol[10]
$PenCol[0] = $Black
$PenCol[1] = $White
$PenCol[2] = $Red
$PenCol[3] = $Green
$PenCol[4] = $Blue
$PenCol[5] = $Yellow

;$PenColour = "0xFFFFFF"
$BackgrndPen = "0x00D8E9EC"

WinMinimizeAll ( )

GUISetState(@SW_SHOW)
$WinPos = WinGetPos($Graphics)

WinSetOnTop ( $Graphics, "", 1 )

HotKeySet("{ESC}","STOP")

;_DrawGraphic()
;_Pause()
;_ClearGraphic()
;_DrawGraphic2()
;_Pause()
;_ClearGraphic()
;_DrawGraphic3()
;_Pause()
;_ClearGraphic()
;_DrawGraphic4()
;_Pause()
;_ClearGraphic()
;_DrawGraphic5() ;Sphere
;_Pause()
;_ClearGraphic()
;_DrawGraphic6()
;_Pause()
;_ClearGraphic()
;_DrawGraphic7()
;_Pause()
;_ClearGraphic()
;_DrawGraphic8()
;_Pause()
;_ClearGraphic()
;_DrawGraphic9()
;_Pause()
;_ClearGraphic()
;_DrawGraphic10()
;_Pause()
;_ClearGraphic()
;_DrawGraphic11()
;_Pause()
;_ClearGraphic()
;_DrawGraphic12()
;_Pause()
;_ClearGraphic()

_DrawGrWork()
;_Pause()
;_ClearGraphic()
;================================
While 1
$msg = GuiGetMsg()
_CheckWin($WinPos[0],$WinPos[1])
Select
    Case $msg = $Prev
    ;;;;

    Case $msg = $Next
        _ClearGraphic()
EndSelect

    Select
    Case $msg = $GUI_EVENT_CLOSE
            DllClose ($gdi_dll)
            DllClose ($user32_dll)
        WinMinimizeAllUndo ( )
        ExitLoop
    EndSelect
WEnd


Func _DrawGraphic()
For $n =0 to 5
$PenColour = $PenCol[$n]
;msgbox(0,"Colour", "Colour is " &$PenVar[$n] &" its value is " &$PenCol[$n] &"Size is " &$Size )
;_DrawGraphic1(0.2)
    For $R =0 to 183 Step 0.2
        $i = int($R/3.6)
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $XOrigin
        $Py= Cos($Rad1)*$Size + $YOrigin
        $X = Sin($Rad)*$Size + $XOrigin
        $Y = Cos($Rad)*$Size + $YOrigin
        ;Sleep(1)                           ;If you want to slow it down
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
    next
    $Size = $Size - 50
Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic1($Step)
    For $R =0 to 183 Step $Step
        $i = int($R/3.6)
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $XOrigin
        $Py= Cos($Rad1)*$Size + $YOrigin
        $X = Sin($Rad)*$Size + $XOrigin
        $Y = Cos($Rad)*$Size + $YOrigin
        ;Sleep(1)           ;If you want to slow it down
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
    Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic2()
$n =0
$Size = 280
For $R1 =0 to 363 step 10
    $Rad1 = _Radian ($R1)
    $X = Sin($Rad1)*$Size + $XOrigin
    $Y = Cos($Rad1)*$Size + $YOrigin
    $PenColour = $PenCol[$n]
    For $R =0 to 363 step 20
        $i = int($R/3.6)
        $Rad = _Radian ($R)
        $Px = Sin($Rad)*$Size + $XOrigin
        $Py= Cos($Rad)*$Size + $YOrigin
        Sleep(1)
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
    Next
$n = $n+1
If $n >5 then $n = 0
Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic3()
$Pen=0
$Size = 280
$X = $XOrigin
$Y = $YOrigin
$Start = 360
$Stop = 0
$inc = 0.2
;$PenColour = $Black
For $n = 0 to 45 step $inc
    $PenColour = $PenCol[$Pen]
    For $R = $Start to $Stop step -45
        $Rad = _Radian ($R)
        $Px = Sin($Rad)*$Size + $XOrigin
        $Py= Cos($Rad)*$Size + $YOrigin
        Sleep(1)
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
$Start = $Start - $inc
$Stop = $Stop + $inc
$Size = $Size - 1
$Pen = $Pen + 1
If $Pen >5 then 
    $Pen = 0
Endif
Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic4()
$Pen=0
$Size = 280
$inc = 1
For $s = 0 to 5
$Start = 360*2
$Stop = 0
    $PenColour = $PenCol[$s]
    For $n = 0 to 90 step $inc
        For $R = $Start to $Stop step -90
            $R1 = $R + 90
            $Rad = _Radian ($R)
            $Rad1 = _Radian ($R1)
            $X = Sin($Rad)*$Size + $XOrigin
            $Y= Cos($Rad)*$Size + $YOrigin
            $Px = Sin($Rad1)*$Size + $XOrigin
            $Py= Cos($Rad1)*$Size + $YOrigin
            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
    $Start = $Start - $inc
    $Stop = $Stop + $inc
    Next
$Size = $Size - 35
Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic5()
$SizeX = 280
$SizeY = 280
$inc = 8
;For $s = 0 to 5
$Start = 360
$Stop = 0
$Stp = 4  ; You can also make to slower or faster by changing the $Stp value
$PenColour = $Black
    For $SizeX = 0 to $SizeY step $inc
        For $R = $Start to $Stop step -$Stp
            $R1 = $R + $Stp
            $Rad = _Radian ($R)
            $Rad1 = _Radian ($R1)
            $X = Sin($Rad)*$SizeX + $XOrigin
            $Y= Cos($Rad)*$SizeY + $YOrigin
            $Px = Sin($Rad1)*$SizeX + $XOrigin
            $Py= Cos($Rad1)*$SizeY + $YOrigin
            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
Next
;_Pause()
$SizeX = 280
$PenColour = $White
For $SizeY = 0 to $SizeX step $inc
    For $R = $Start to $Stop step -$Stp
        $R1 = $R + $Stp
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R1)
        $X = Sin($Rad)*$SizeX + $XOrigin
        $Y= Cos($Rad)*$SizeY + $YOrigin
        $Px = Sin($Rad1)*$SizeX + $XOrigin
        $Py= Cos($Rad1)*$SizeY + $YOrigin
        ;Sleep(1)           ;Slow it down if you want
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
Next
EndFunc
;-------------------------------------------------
Func _DrawGraphic6()
$n =0
$Stp =4
$PenColour = $Black
$Start = 360
$Stop = 0
$SizeMax = 250
$M = 4
    For $Size =$SizeMax to 10 Step -4
        $SizeX= $Size
        $SizeY = $Size
        $PenColour = $PenCol[$Pen]
        For $R = $Start to $Stop step -$Stp
            $R1 = $R + $Stp

            $Rad = _Radian ($R)
            $X = Sin($Rad*$M)*$SizeX + $XOrigin
            $Y = Cos($Rad)*$SizeY + $YOrigin

            $Rad1 = _Radian ($R1 )
            $Px = Sin($Rad1*$M)*$SizeX + $XOrigin
            $Py = Cos($Rad1)*$SizeY + $YOrigin

            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
            ;_IncCol($Pen)
    ;       $PenColour = $PenCol[$Pen]
    next
;_Cont()
$PenColour = $White

    For $Size =$SizeMax to 10 Step -4
        $SizeX= $Size
        $SizeY = $Size
        For $R = $Start*2 to $Stop step -$Stp
            $R1 = $R + $Stp

            $Rad = _Radian ($R)
            $X = Sin($Rad)*$SizeX + $XOrigin
            $Y = Sin($Rad*$M)*$SizeY + $YOrigin

            $Rad1 = _Radian ($R1 )
            $Px = Sin($Rad1)*$SizeX + $XOrigin
            $Py = Sin($Rad1*$M)*$SizeY + $YOrigin

            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
    ;       _IncCol($Pen)
    ;       $PenColour = $PenCol[$Pen]
    next
EndFunc
;-------------------------------------------------
Func _DrawGraphic7()
$Pencolour=$Black
$inc = 45
$SizeX = 180
$SizeY = 180
$Start = 360
$Stop = 0

$Stp = 10  ; You can also make to slower or faster by changing the $Stp value
$PenColour = $Black
$M = 2
    For $R0 = $Start to $Stop step -1
        $Rad0 = _Radian ($R0)
        $OrgSetX = Sin($Rad0*$M)*$SizeX + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY + $YOrigin

        For $R = $Start to $Stop step -$Stp
            ;$OrgSetX = $XOrigin
            ;$OrgSetY = $YOrigin

            $Rad = _Radian ($R)
            $X = Sin($Rad)*$SizeX/2 + $OrgSetX
            $Y = Cos($Rad)*$SizeY/2 + $OrgSetY

            $R1 = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px = Sin($Rad1)*$SizeX/2 + $OrgSetX
            $Py = Cos($Rad1)*$SizeY/2 + $OrgSetY
            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        Next
;   _Cont()
    Next
EndFunc
;-----------------------------------------------------------------------------

Func _DrawGraphic8()
$PenColour = $Black
$Steps =120
$Stp = 10
$Start = 360
$Stop = 0
$Stp = 2 
$Div = 2
$n= -33304  
$Size = 380
$SizeX = 170
$SizeY = $SizeX


;Set start point
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

For $inc = 0 to 18 step 0.5
$Size = $Size - $inc
;Set start point
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

    For $R = $Stop to $Start step $Stp

        $Radn = _Radian ($n)
        $OrgSetPx = Sin($Radn)*$SizeX/$Div + $XOrigin
        $OrgsetPy = Cos($Radn)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($R)
        $Px = Sin($Rad)*$Size/$Div + $OrgSetPx
        $Py = Cos($Rad)*$Size/$Div + $OrgSetPy

        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenColour)
        $X = $Px
        $Y = $Py
        $n = $n - 8
        ;Sleep(1)                           ;If you want to slow it down
    next
next
EndFunc

;-----------------------------------------------------------------------------

Func _DrawGraphic9()
$PenColour = $Black
$Pen = 0
$Steps =120
$Start = 360
$Stop = 0
$Div = 2
;$n= 0
$Size = 380
$SizeX = 170
$SizeY = $SizeX
$IncN = 20
$Sleep = 1
$Count = 0
$Stp = 2        ;Rotate by this Increment
$n = 0
$Stp1 = 4

;Set start point
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

For $inc = 0 to 320 Step 0.5
$Size = $Size - 0.5
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin
        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

    For $R = $Stop to $Start step $Stp

        $Radn = _Radian ($n)
        $OrgSetPx = Sin($Radn)*$SizeX/$Div + $XOrigin
        $OrgsetPy = Cos($Radn)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($R)
        $Px = Sin($Rad)*$Size/$Div + $OrgSetPx
        $Py = Cos($Rad)*$Size/$Div + $OrgSetPy

        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
        $X = $Px
        $Y = $Py
        $n = $n - $Stp
        ;Sleep(1)                           ;If you want to slow it down
    next
        If $Inc = $IncN * $Count Then
            _Tog($Pen)
            ;_IncCol($Pen)
            ;_DrawDot($Px,$Py)
            $Count = $Count + $Stp1
        ControlFocus("Graphics","","")
        Endif

        ;MsgBox(0,"BreakPoint", "Increment = " &$Inc &" Count = " &$Count)
;   _DrawDot($X,$Y)
;   _Cont()
next
    MsgBox(0,"ALL DONE", "THE END!")
    WinMinimizeAllUndo ( )
    Exit
EndFunc
;------------------------------------------------------------------------------
Func _DrawGraphic10()
    $Count = 0
    $Stp = 4
    $IncR = 45
    $Pen = 0
    $n = 0
    $Stop = 360*4
    For $R = $Stop to 0 Step -0.5
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $XOrigin
        $Py= Cos($Rad1)*$Size + $YOrigin
        $X = Sin($Rad)*$Size + $XOrigin
        $Y = Cos($Rad)*$Size + $YOrigin
        ;Sleep(1)                           ;If you want to slow it down
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])       
        _DrawDot ($X,$Y)
        _DrawDot ($Px,$Py)
        $Size = $Size - 0.1
            If $R = $Stop - $IncR * $Count Then
                ;_Tog($Pen)
                _IncCol($Pen)
                $Count = $Count + 1
            Endif
        ControlFocus("Graphics","","")
    next
EndFunc
;------------------------------------------------------------------------------
Func _DrawGraphic11()
    ;Msgbox(0,"","Colour is " &$n )
    $Count = 0
    $Stp = 4
    $IncR = 45
    $DotTog = 2
    $Pen = 0
    $n = 0
    $Cnt = 0
    $Size = 240
    $Stop = 360*13
    For $R = $Stop to 0 Step -10
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $XOrigin
        $Py= Cos($Rad1)*$Size + $YOrigin
        $X = Sin($Rad)*$Size + $XOrigin
        $Y = Cos($Rad)*$Size + $YOrigin
        ;Sleep(1)                           ;If you want to slow it down
        ;_DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
        _CircleFill ($X,$Y,20,4)
        For $i = 1 to 2
            _Circle($X,$Y,20 - $i,2)
        next
        $Size = $Size - 0.5
            If $R = $Stop - $IncR * $Count Then
                ;_Tog($Pen)
                _IncCol($Pen)
                $Count = $Count + 1
            Endif
        ControlFocus("Graphics","","")
        ;MsgBox(0,"BreakPoint", "R = " &$R &" Count = " &$Count)
    next
EndFunc
;------------------------------------------------------------------------------
Func _DrawGraphic12()
    ;Msgbox(0,"","Colour is " &$n )
    $Count = 0
    $Stp = 4
    $IncR = 45
    $DotTog = 2
    $Pen = 0
    $n = 0
    $Cnt = 0
    $Size = 20
    $Stop = 360*15
    For $R = $Stop to 0 Step -8
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $XOrigin
        $Py= Cos($Rad1)*$Size + $YOrigin
        $X = Sin($Rad)*$Size + $XOrigin
        $Y = Cos($Rad)*$Size + $YOrigin
        ;Sleep(1)                           ;If you want to slow it down
        ;_DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
        _CircleFill ($X,$Y,20,4)
        For $i = 1 to 2
            _Circle($X,$Y,20 - $i,2)
        next
        $Size = $Size + 0.3
            If $R = $Stop - $IncR * $Count Then
                ;_Tog($Pen)
                _IncCol($Pen)
                $Count = $Count + 1
            Endif
        ControlFocus("Graphics","","")
        ;MsgBox(0,"BreakPoint", "R = " &$R &" Count = " &$Count)
    next
EndFunc
;------------------------------------------------------------------------------
Func _DrawGrWork()
$PenColour = $Black
$Pen = 0
$Steps =120
$Start = 360
$Stop = 0
$Div = 2
;$n= 0
$Size = 380
$SizeX = 170
$SizeY = $SizeX
$IncN = 20
$Sleep = 1
$Count = 0
$Stp = 2        ;Rotate by this Increment
$n = 0
$Stp1 = 4

;Set start point
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

For $inc = 0 to 320 Step 0.5
$Size = $Size - 0.5
        $Rad0 = _Radian ($n)
        $OrgSetX = Sin($Rad0)*$SizeX/$Div + $XOrigin
        $OrgsetY = Cos($Rad0)*$SizeY/$Div + $YOrigin
        $Rad = _Radian ($Start)
        $X = Sin($Rad)*$Size/$Div + $OrgSetX
        $Y = Cos($Rad)*$Size/$Div + $OrgsetY

    For $R = $Stop to $Start step $Stp

        $Radn = _Radian ($n)
        $OrgSetPx = Sin($Radn)*$SizeX/$Div + $XOrigin
        $OrgsetPy = Cos($Radn)*$SizeY/$Div + $YOrigin

        $Rad = _Radian ($R)
        $Px = Sin($Rad)*$Size/$Div + $OrgSetPx
        $Py = Cos($Rad)*$Size/$Div + $OrgSetPy

        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
        $X = $Px
        $Y = $Py
        $n = $n - $Stp
        ;Sleep(1)                           ;If you want to slow it down
    next
        If $Inc = $IncN * $Count Then
            _Tog($Pen)
            ;_IncCol($Pen)
            ;_DrawDot($Px,$Py)
            $Count = $Count + $Stp1
        ControlFocus("Graphics","","")
        Endif

        ;MsgBox(0,"BreakPoint", "Increment = " &$Inc &" Count = " &$Count)
;   _DrawDot($X,$Y)
;   _Cont()
next
    MsgBox(0,"ALL DONE", "THE END!")
    WinMinimizeAllUndo ( )
    Exit
EndFunc

;--------------------------- Draw a Circle ------------------------------------
Func _Circle($OrgX,$OrgY,$Size,$Pen)
    $Stp = 10
        For $R = 360 to 0 step -$Stp

            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $OrgX
            $Y= Cos($Rad)*$Size + $OrgY

            $R1 = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px = Sin($Rad1)*$Size + $OrgX
            $Py= Cos($Rad1)*$Size + $OrgY
            ControlFocus("Graphics","","")
            ;Sleep(1)           ;Slow it down if you want
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
        Next
EndFunc
;--------------------------- Draw a Filled Circle --------------------------
Func _CircleFill($OrgX,$OrgY,$Size,$Pen)
;msgbox(0,"Colour", "Colour is " &$PenVar[$n] &" its value is " &$PenCol[$n] &"Size is " &$Size )
        ControlFocus("Graphics","","")
    For $R =0 to 183 Step 4
        $Rad = _Radian ($R)
        $Rad1 = _Radian ($R+180)
        $Px = Sin($Rad1)*$Size + $OrgX
        $Py= Cos($Rad1)*$Size + $OrgY
        $X = Sin($Rad)*$Size + $OrgX
        $Y = Cos($Rad)*$Size + $OrgY
        ;Sleep(1)                           ;If you want to slow it down
        _DrawLine ($Graphics,$X,$Y,$Px,$Py,$PenCol[$Pen])
    next
EndFunc
;--------------------------- Draw a Dot ------------------------------------
Func _DrawDot($DotX,$DotY)
    Local $Start = 360
    Local $Stop = 0
    Local $Stp = 90
    Local $Pen = $Black
    For $Size = 4 to 2 step -2
        For $R = $Start to $Stop step -$Stp
            
            $Rad = _Radian ($R)
            $X = Sin($Rad)*$Size + $DotX
            $Y = Cos($Rad)*$Size + $DotY
            
            $R1 = $R + $Stp
            $Rad1 = _Radian ($R1)
            $Px = Sin($Rad1)*$Size + $DotX
            $Py = Cos($Rad1)*$Size+ $DotY
            _DrawLine ($Graphics,$X,$Y,$Px,$Py,$Pen)
            ControlFocus("Graphics","","")
        Next

    Local $Pen = $Yellow    
    Next
EndFunc

;=============================================================================================
Func _ClearGraphic()
    GUICtrlSetGraphic($Gh, $GUI_GR_REFRESH)
EndFunc

Func _Pause()
msgbox(0,"Pause","View Next Graphic?")
_ClearGraphic()
EndFunc

Func _Cont()
msgbox(0,"","Continue?")
EndFunc

Func _IncCol(ByRef $Pen)
    $Pen = $Pen + 1
    If $Pen >5 then 
        $Pen = 0
    EndIF
EndFunc

Func Stop()
    Exit
EndFunc

Func _Tog(ByRef $Pen)
    If $Pen = 0 then
        $Pen = 1
    Else
        $Pen = 0
    EndIf
EndFunc 

Func _CheckWin($WinX,$WinY)
    If $WinX <> $WinX or $WinY <> $WinY then 
        run("Rundll32 user,repaintscreen")
        $WinX = $WinPos[0]
        $WinY = $WinPos[1]
        WinMinimizeAll ( )
    EndIf
EndFunc

Func _DrawLine($GUI,$x, $y, $EndPntX, $EndPointY, $PenColour)
    $GUIHDC = DllCall ($user32_dll,"int","GetDC","hwnd", $GUI)
    $Pen = DllCall($gdi_dll, "hwnd", "CreatePen", "int", "0", "int", "0", "hwnd", $PenColour)
    $Pen = $Pen[0]
    DllCall($gdi_dll, "hwnd", "SelectObject", "hwnd", $GUIHDC[0], "hwnd", $Pen)
    DllCall ($gdi_dll, "int", "MoveToEx", "hwnd", $GUIHDC[0], "int", $x, "int", $y, "ptr", 0)
    DllCall ($gdi_dll, "int", "LineTo", "hwnd", $GUIHDC[0], "int", $EndPntX, "int", $EndPointY)
    DllCall ($user32_dll,"int","ReleaseDC","int",$GUIHDC[0],"hwnd",$GUI)
EndFunc

Maybe this should have been in a code box?? :D

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...