private void Redraw() { clock.SetTime(timePicker.Value); using (var g = Graphics.FromImage(clockFace.Image)) { g.Clear(Color.Transparent); g.DrawEllipse( Pens.Black, clock.TopLeftCorner.X, clock.TopLeftCorner.Y, clock.Radius * 2, clock.Radius * 2); g.DrawLine( smallHandPen, clock.Center.X, clock.Center.Y, clock.SmallHandPoint.X, clock.SmallHandPoint.Y); g.DrawLine( largeHandPen, clock.Center.X, clock.Center.Y, clock.LargeHandPoint.X, clock.LargeHandPoint.Y); clockFace.Refresh(); } txtAngle.Text = string.Format("{0}°", clock.AngleDegrees); }
public IHttpActionResult GetAngle(int hours, int minutes, int width, int height) { ClockFace clock = new ClockFace(width, height); clock.SetTime(new TimeSpan(hours, minutes, 0)); return(Ok(clock)); }
public ZegarekViewModel() { Clock = new ClockFace(ClockFaceWidth, ClockFaceHeight); Clock.SetTime(DateTime.Now); }