Saturday, May 5, 2012

Analog Clock





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Examples
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int iSec = 0;
        int iMin = 0;
        int iHr = 0;
        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = e.Graphics;
            g.DrawPie(Pens.Blue,50,50,200,200,0,90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 90, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 180, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 270, 90);
            g.DrawPie(Pens.Green, 50, 50, 200, 200, 90, iSec);
            iSec += 4;

            if (iSec == 360)
            {
                iMin += 6;
                iSec = 0;
            }
            g.DrawPie(Pens.Red, 50, 50, 200, 200, 90, iMin);

            if (iMin == 360)
            {
                iHr += 6;
                iMin = 0;
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Invalidate();
        }
    }
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...