JustinReno Posted March 7, 2008 Share Posted March 7, 2008 I'm trying to make an analog clock with GuiCtrlSetGraphic and I'm trying to get the program to make a circle out of dotted points, but I'm stuck. Any help? #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: JustinReno Script Function: A simple clock. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> Global $Pi = 3.14 Global $Hour $GUI = GUICreate("Simple Clock", 237, 221) $Graphic = GUICtrlCreateGraphic(0, 0, 236, 220) GUISetState(@SW_SHOW, $GUI) While 1 GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) Sleep(10) Switch GUIGetMsg() Case - 3 Exit EndSwitch If @Hour > 10 Then $Hour = @HOUR - 12 For $I = 1 To 360 GUICtrlSetGraphic($Graphic, $GUI_GR_DOT, $Pi - $I, $I) Next WEnd Link to comment Share on other sites More sharing options...
ReaImDown Posted March 7, 2008 Share Posted March 7, 2008 (edited) I'm trying to make an analog clock with GuiCtrlSetGraphic and I'm trying to get the program to make a circle out of dotted points, but I'm stuck. Any help? #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: JustinReno Script Function: A simple clock. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> Global $Pi = 3.14 Global $Hour $GUI = GUICreate("Simple Clock", 237, 221) $Graphic = GUICtrlCreateGraphic(0, 0, 236, 220) GUISetState(@SW_SHOW, $GUI) While 1 GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) Sleep(10) Switch GUIGetMsg() Case - 3 Exit EndSwitch If @Hour > 10 Then $Hour = @HOUR - 12 For $I = 1 To 360 GUICtrlSetGraphic($Graphic, $GUI_GR_DOT, $Pi - $I, $I) Next WEndcant you just make a circle in paint? and then make the minute / second / hour hands in paint, then position them accordingly? just an idea Edited March 7, 2008 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted March 7, 2008 Author Share Posted March 7, 2008 No. Link to comment Share on other sites More sharing options...
ReaImDown Posted March 7, 2008 Share Posted March 7, 2008 No.well, that was straight forward, good luck lol [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted March 7, 2008 Author Share Posted March 7, 2008 It would be more space efficent. Link to comment Share on other sites More sharing options...
ReaImDown Posted March 7, 2008 Share Posted March 7, 2008 It would be more space efficent. true, and with that, you can also do cool affects if and when the user drags the window. [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
martin Posted March 7, 2008 Share Posted March 7, 2008 I'm trying to make an analog clock with GuiCtrlSetGraphic and I'm trying to get the program to make a circle out of dotted points, but I'm stuck. Any help? #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: JustinReno Script Function: A simple clock. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> Global $Pi = 3.14 Global $Hour $GUI = GUICreate("Simple Clock", 237, 221) $Graphic = GUICtrlCreateGraphic(0, 0, 236, 220) GUISetState(@SW_SHOW, $GUI) While 1 GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) Sleep(10) Switch GUIGetMsg() Case - 3 Exit EndSwitch If @Hour > 10 Then $Hour = @HOUR - 12 For $I = 1 To 360 GUICtrlSetGraphic($Graphic, $GUI_GR_DOT, $Pi - $I, $I) Next WEnd You can draw lines, circles or anything with GuiCtrlSetGraphic. Have a look at the help. Here's a start, not with lines, but it gives an idea. #include <GUIConstants.au3> $gui=GUICreate("outer ring",440,440) $a=GuiCtrlCreateGraphic(20, 20, 400,400) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x000000,0xffffff) for $arc = 0 to 59 GUICtrlSetGraphic(-1,$GUI_GR_DOT,200+180*Cos($arc * 3.1459/30)-2,200 + 180*sin($arc * 3.1459/30)-2) Next GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffbbcc) $dotdia = 10;actually radius for $deg = 0 to 11 GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE,200 + (190-$dotdia)*Cos($deg * 3.1459/6)-$dotdia,200- (190-$dotdia)*Sin($deg * 3.1459/6)-$dotdia,2*$dotdia,2*$dotdia) next GuiSetState() while guigetmsg() <> -3 WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ReaImDown Posted March 7, 2008 Share Posted March 7, 2008 You can draw lines, circles or anything with GuiCtrlSetGraphic. Have a look at the help. Here's a start, not with lines, but it gives an idea. #include <GUIConstants.au3> $gui=GUICreate("outer ring",440,440) $a=GuiCtrlCreateGraphic(20, 20, 400,400) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x000000,0xffffff) for $arc = 0 to 59 GUICtrlSetGraphic(-1,$GUI_GR_DOT,200+180*Cos($arc * 3.1459/30)-2,200 + 180*sin($arc * 3.1459/30)-2) Next GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffbbcc) $dotdia = 10;actually radius for $deg = 0 to 11 GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE,200 + (190-$dotdia)*Cos($deg * 3.1459/6)-$dotdia,200- (190-$dotdia)*Sin($deg * 3.1459/6)-$dotdia,2*$dotdia,2*$dotdia) next GuiSetState() while guigetmsg() <> -3 WEnd I like... [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted March 7, 2008 Author Share Posted March 7, 2008 You can draw lines, circles or anything with GuiCtrlSetGraphic. Have a look at the help. Here's a start, not with lines, but it gives an idea. #include <GUIConstants.au3> $gui=GUICreate("outer ring",440,440) $a=GuiCtrlCreateGraphic(20, 20, 400,400) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x000000,0xffffff) for $arc = 0 to 59 GUICtrlSetGraphic(-1,$GUI_GR_DOT,200+180*Cos($arc * 3.1459/30)-2,200 + 180*sin($arc * 3.1459/30)-2) Next GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffbbcc) $dotdia = 10;actually radius for $deg = 0 to 11 GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE,200 + (190-$dotdia)*Cos($deg * 3.1459/6)-$dotdia,200- (190-$dotdia)*Sin($deg * 3.1459/6)-$dotdia,2*$dotdia,2*$dotdia) next GuiSetState() while guigetmsg() <> -3 WEnd How did you come up with this? Its very cool! Link to comment Share on other sites More sharing options...
martin Posted March 8, 2008 Share Posted March 8, 2008 How did you come up with this? Its very cool!?? Glad you like it but it's just a doodle to show you drawing things around a circle. I thought I'll put a dot for each minute and a little circle for every 5 minutes and if I draw the 5 minute circles after the little dots then I don't have to worry about missing out every 5th dot. Just took a guess at colours. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
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