コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public ZegarekViewModel()
 {
     Clock = new ClockFace(ClockFaceWidth, ClockFaceHeight);
     Clock.SetTime(DateTime.Now);
 }