Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to create an analog clock using winforms in f#. The clock also needs to have a label showing date and time in digital form. I have figures out the label time/date, but I'm having problems configurering the graphical representation of the clock and implement the timer function. Is there anyone who can help me on my way?

What I have tried:

F#
open System.Windows.Forms
open System.Drawing
open System

let win = new Form () 
win.ClientSize <- Size (500, 500)

let label = new Label ()
win.Controls.Add label
label.Width <- 200 
label.Text <- string System.DateTime.Now

let timer = new Timer()
timer.Interval <- 1000
timer.Enabled <- true
timer.Tick.Add (fun e -> label.Text <- string System.DateTime.Now)

Application.run win
Posted
Updated 17-Jan-18 4:38am
v2
Comments
Richard MacCutchan 17-Jan-18 8:18am    
You likely need to use the graphics class to draw the clock. And each time your timer tick event occurs, you update the images. Google for F# (or C#) graphics, to find ideas.

1 solution

yes take a timer

arrage the labels with no text as shape of 8 .

according to the interval some labe back color change from gray to green
 
Share this answer
 
Comments
Richard Deeming 17-Jan-18 15:32pm    
That sounds like a digital clock, not an analog clock.
Dotnet_Dotnet 19-Jan-18 10:36am    
sir I am telling about degital clock
okany way I will provide you the code but
you have to wait

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900