如何在F#中使用winforms创建模拟时钟? [英] How do I create an analog clock using winforms in F#?

查看:86
本文介绍了如何在F#中使用winforms创建模拟时钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用f#中的winforms创建模拟时钟。时钟还需要有一个标签,以数字形式显示日期和时间。我已经计算出标签的时间/日期,但是我在配置时钟的图形表示并实现定时器功能时遇到了问题。有没有人可以帮我上路?



我尝试过的事情:



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:

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

推荐答案

是需要一个计时器



arrage没有文字形状为8的标签。



根据间隔的颜色变化从灰色变为绿色
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


这篇关于如何在F#中使用winforms创建模拟时钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆