Jump to content

Circle for countdown


dickep
 Share

Recommended Posts

Ok, I am trying to make a countdown timer. I got the timer part down, now I want to use a circle (large) to display it graphically.

What I want is a circle (green) and then each second of the time remaining will change 1/x (x being the total time for the count down - like 5 minutes).

So, how do I (1) draw the circle? Then how do I calculate and re-write the circle to reflect the "cut out" part (the time used versus the time remaining) - would actually like to change that portion of the circle to red.

Thanks for helping

E

Link to comment
Share on other sites

  • Moderators

dickep,

Something like this perhaps? ;)

#include <GUIConstantsEx.au3>

Global $aLabels[360]

$hGUI = GUICreate("Test", 500, 500)

For $i = 359 To 0 Step -1

    $nAngle = $i * 4 * ATan(1) / 180

    $iX = 250 + (100 * Sin($nAngle))
    $iY = 250 + (100 * Cos($nAngle))

    $aLabels[$i] = GUICtrlCreateLabel("", $iX, $iY, 5, 5)
    GUICtrlSetBkColor(-1, 0x00FF00)

Next

GUISetState()

$iBegin = TimerInit()

$iCount = 0

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    If TimerDiff($iBegin) > 500 Then
        GUICtrlSetBkColor($aLabels[$iCount], 0xFF0000)
        $iCount += 1
        $iBegin = TimerInit()
    EndIf

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Here my fast hack:

Version1:

;Fast hack by UEZ ;-)
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Local $w = 600, $h = 600

; Initialize GDI+
_GDIPlus_Startup()

Local $hGUI = GUICreate("GDI+ Countdown Circle", $w, $h)
GUISetState()

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

; Using antialiasing
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

; Create a Pen object
Local $pen_size = 100
Local $hPen = _GDIPlus_PenCreate(0, $pen_size)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

; Setup font parameters
Local $fx
Local $font = "Arial"
Local $fsize = 80
Local $angle = 0
Local $countdown_t = 120 ;seconds
Local $countdown = $countdown_t
Local $parts = Ceiling(360 / $countdown_t)

AdlibRegister("Timer", 1000)

While Sleep(100)

    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xFFE0FFE0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
    _GDIPlus_PenSetColor($hPen, 0xFF00FF00)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, $angle, $hPen)
    $fx = StringLen($countdown) * $fsize / 2.25
    _GDIPlus_GraphicsDrawString($hBackbuffer, $countdown, $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)

WEnd

Func Timer()
    If $angle < 360 Then
        $angle += $parts
        $countdown -= 1
    Else
        $angle = 0
        $countdown = $countdown_t
    EndIf
EndFunc

Func _Exit()
    AdlibUnRegister("Timer")
    ; Clean up
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    Exit
EndFunc

Version2:

;Fast hack by UEZ ;-)
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Local $h = 600, $w = $h

; Initialize GDI+
_GDIPlus_Startup()

Local $hGUI = GUICreate("GDI+ Countdown Circle", $w, $h)
WinSetTrans($hGUI,"", 255)
GUISetState()

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

; Using antialiasing
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

; Create a Pen object
Local $pen_size = Floor($h / 6)
Local $hPen = _GDIPlus_PenCreate(0, $pen_size)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

; Setup font parameters
Local $fx
Local $font = "Arial"
Local $fsize = Floor($h / 10)
Local $angle = 360
Local $countdown_t = 10 ;seconds
Local $countdown = $countdown_t
Local $t_calc = Round(1000 * ($countdown_t + 1) / 360, 0)

Local $timer = TimerInit()

While 1

    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xFFE0FFE0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
    _GDIPlus_PenSetColor($hPen, 0xFF00FF00)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, $angle, $hPen)
    $fx = StringLen(StringFormat("%.2f", $countdown)) * $fsize / 2.5
    _GDIPlus_GraphicsDrawString($hBackbuffer, StringFormat("%.2f", $countdown), $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)

    If TimerDiff($timer) > $t_calc Then
        $countdown -= $t_calc / 1000
        $timer = TimerInit()
        $angle = 360 * $countdown / $countdown_t
        If $countdown < 0 Then
            $countdown = $countdown_t
            $angle = 360
            $timer = TimerInit()
        EndIf
    EndIf

WEnd


Func _Exit()

    ; Clean up
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    Exit
EndFunc

I hope it is something what you searching for.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Moderators

UEZ,

Nice. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

UEZ, thanks. I really like it but... well, need to look up the GDIPlus stuff to fully understand.

However, if I put in more than the 15 "seconds", the thing does not work right. Is there a reason? I looked at the code, but don't really understand where to change what to make the time work right - just changing "countdown_t" value does not work for any value.

E

Link to comment
Share on other sites

UEZ, thanks. I really like it but... well, need to look up the GDIPlus stuff to fully understand.

However, if I put in more than the 15 "seconds", the thing does not work right. Is there a reason? I looked at the code, but don't really understand where to change what to make the time work right - just changing "countdown_t" value does not work for any value.

E

Indeed, the calculation with this method was not accurate enough. I updated the example (version 2).

Please check this out.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Getting intermittent gui(drawing) flashes. Probably related to older vid-hardware on this side.

Following code seems to counter act them. (In my case at least.)

For those that have a similar problem. just place it somewhere in the top part of the script/code.)

Edit: better workaround/fix below.

Global Const $WM_ERASEBKGND = 0x0014 ;; <WindowsConstants.au3>
GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
Func WM_ERASEBKGND()
    Return 1
EndFunc
Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

If you are using WinXP try this:

...
Local $hGUI = GUICreate("GDI+ Countdown Circle", $w, $h)
WinSetTrans($hGUI,"", 255)
GUISetState()
...

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

If you are using WinXP try this:

WinXP Yes. And working. Thanks.

Just in case. Do you know why this also works. (?)(Assume I know nothing.)

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

I opened this thread a while ago -> http://www.autoitscript.com/forum/index.php?showtopic=97462 but I don't know why this

workaround is working! It was discovered by eukalyptus.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

UEZ - that is nice, is there anyway to pop that ring up on a transparent GUI?

set layered window attributes has no effect as you can witness in the example and I saw past threads where you said true transparency was not achievable with gdiplus (that was however in relationship to .pngs, so may not apply), any way to fake it?

Also in my additions, the ring goes to flickering red at 5 seconds, and freezes rrod and states Elapsed.

;Fast hack by UEZ ;-)
#include <GDIP.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <WinAPI.au3>

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 2)

Local $w = 600, $h = 600

; Initialize GDI+
_GDIPlus_Startup()

Global $hGUI = GUICreate("Countdown", $w, $h, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD))



GUISetState()

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_WinAPI_SetLayeredWindowAttributes($hGraphics, 0xFFFFFF)


; Using antialiasing
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

; Create a Pen object
Local $pen_size = 100
Local $hPen = _GDIPlus_PenCreate(0, $pen_size)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

; Setup font parameters
Local $fx
Local $font = "Arial"
Local $fsize = 60
Local $angle = 360
Local $countdown_t = 10 ;seconds
Local $countdown = $countdown_t
Local $t_calc = 1000 * ($countdown_t + 1) / 360

Local $timer = TimerInit()



While 1



If $countdown >= 5 Then

    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    
    _GDIPlus_PenSetColor($hPen, 0xFFE0FFE0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
    _GDIPlus_PenSetColor($hPen, 0xFF00FF00)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, $angle, $hPen)
    $fx = StringLen(StringFormat("%.2f", $countdown)) * $fsize / 2.5
  _GDIPlus_GraphicsDrawString($hBackbuffer, StringFormat("%.2f", $countdown), $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)
    
        Endif
    
    If $countdown < 5 Then
        If $countdown > 0 Then

    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
   _GDIPlus_PenSetColor($hPen, 0xFFFFE0E0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
    _GDIPlus_PenSetColor($hPen, 0xFFFF0000)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, $angle, $hPen)
    $fx = StringLen(StringFormat("%.2f", $countdown)) * $fsize / 2.5
   _GDIPlus_GraphicsDrawString($hBackbuffer, StringFormat("%.2f", $countdown), $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)
    
        Endif
            Endif
    If $countdown < 5 Then
        If $countdown > 0 Then
    
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
  _GDIPlus_PenSetColor($hPen, 0xFFFFE0E0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
 _GDIPlus_GraphicsDrawString($hBackbuffer, StringFormat("%.2f", $countdown), $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
 _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, 0, $hPen)
 _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)
    Endif

If $countdown <= 0 Then
            $countdown = ''
            $angle = 360
            $timer = -1
            While 1
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
  _GDIPlus_PenSetColor($hPen, 0xFFE0FFE0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
_GDIPlus_GraphicsDrawString($hBackbuffer, 'ELAPSED', $w / 2 - $fx * 2, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_PenSetColor($hPen, 0xFFFF0000)
 _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, 360, $hPen)
 _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)
 
 Wend

sleep(1000)
EndIf
Endif
        
    
         If TimerDiff($timer) > $t_calc Then
        $countdown -= $t_calc / 1000
        $timer = TimerInit()
        $angle = 360 * $countdown / $countdown_t

Endif 

WEnd


Func _Exit()

    ; Clean up
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    Exit
EndFunc
Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Here with transparent GUI:

;Fast hack by UEZ ;-)
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "GDI+ Countdown Circle Transparent_Obfuscated.au3"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"

#include <Color.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)

Local $h = 150, $w = $h

; Initialize GDI+
_GDIPlus_Startup()

Local $hGUI = GUICreate("GDI+ Countdown Circle", $w, $h, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
;~ WinSetTrans($hGUI,"", 255)
Local $bg = 0xFFFFFF
GUISetBkColor($bg)
_WinAPI_SetLayeredWindowAttributes($hGui, $bg)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

; Using antialiasing
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

; Create a Pen object
Local $pen_size = Floor($h / 6)
Local $hPen = _GDIPlus_PenCreate(0, $pen_size)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

; Setup font parameters
Local $fx
Local $font = "Arial"
Local $fsize = Floor($h / 10)
Local $angle = 360
Local $countdown_t = 20 ;seconds
Local $countdown = $countdown_t
Local $t_calc = Round(1000 * ($countdown_t + 1) / 360, 0)
Local $timer = TimerInit()
Local $flash_color[3]
$flash_color[1] = 0x00
$flash_color[2] = 0x00
Local $z = 1

While 1

    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xFFE0FFE0)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, $hPen)
    If $countdown > 5 Then
    _GDIPlus_PenSetColor($hPen, 0xFF00FF00)
    Else
    $flash_color[0] = Max(0xB0, Abs(0xFF * Sin($z / (0xC0 * $countdown))))
    _GDIPlus_PenSetColor($hPen, "0xFF" & Hex(_ColorSetRGB($flash_color), 6))
    EndIf
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $pen_size / 2, $pen_size / 2, $w - $pen_size, $h - $pen_size, -90, $angle, $hPen)
    $fx = StringLen(StringFormat("%.2f", $countdown)) * $fsize / 2.5
    _GDIPlus_GraphicsDrawString($hBackbuffer, StringFormat("%.2f", $countdown), $w / 2 - $fx, $h / 2 - $fsize * 0.75, $font, $fsize)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $w, $h)

    If TimerDiff($timer) > $t_calc Then
    $countdown -= $t_calc / 1000
    $timer = TimerInit()
    $angle = 360 * $countdown / $countdown_t
    If $countdown <= 0 Then
    $countdown = $countdown_t
    $angle = 360
    $timer = TimerInit()
    EndIf
    EndIf
    $z += 2
WEnd

Func Max($a, $b)
    If $a >= $b Then
    Return $a
    Else
    Return $b
    EndIf
EndFunc

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $hGui) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST

Func _Exit()

    ; Clean up
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    Exit
EndFunc

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 1 year later...

I'm fresh to autoit, and i know it's an old topic. But i wonder if there is any possibility to implant a pause function here.

Need this to make a timer for a gamer (my child), witch is always playing toooo long. Because this GUI is verry nice i will try to make this work.

password and mouse capture i've already accomplished.

Hope someone has the solution for my needs.

Greetz.

Link to comment
Share on other sites

  • Moderators

Meesterlijk,

Welcome to the AutoIt forum. :)

Need this to make a timer for a gamer

password [...] capture i've already accomplished

A couple of things you have said there make me rather uncomfortable. Please read the Forum Rules before you post again - then we can avoid any future unpleasantness. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Meesterlijk,

Delighted to hear it. See you around. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...