Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System.Windows.Forms
- open System.Drawing
- let f = new Form(Text="Clock", TopMost= true,Size=Size(1920, 1080))
- type AnalogClock()=
- inherit UserControl()
- let mutable current = 0.f
- let mutable x,y = 10.f,10.f
- member this.DateTIme
- with get() = current
- and set(v) = current <- v;
- override this.OnPaint e =
- let g = e.Graphics
- let t = g.Transform
- let transform = g.Transform
- t.Translate(x,y)
- g.Transform <- t
- g.DrawRectangle(Pens.Red, 0.f, 0.f,50.f,50.f)
- g.Transform <- transform
- x <- x + 1.f
- y <- y + 1.f
- ///////////////////////////////////////////////
- let clock1 = new AnalogClock(Size=Size(f.Width, f.Height))
- let t = new Timer(Interval=25)
- t.Tick.Add(fun _ ->
- clock1.Invalidate() //Importantissimo altrimenti non va
- f.Invalidate()
- )
- t.Start()
- f.Controls.Add(clock1)
- Application.Run(f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement