基本信息
源码名称:画图时钟示例(Graphics入门级示例)
源码大小:0.04M
文件格式:.rar
开发语言:C#
更新时间:2020-05-26
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

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 shizhong
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            int j,m,h,r; string a,b,c;
            Graphics g = this.CreateGraphics();
            Pen pen1 = new Pen(Color.Red, 3);
            Pen pen2 = new Pen(Color.BurlyWood , 2);
            double x, y, i,x0,y0,x1,y1;
            float p,q;
           
           g.Clear(this.BackColor);
           r = textBox1.Text.Length;
          
               j = Convert.ToInt16(textBox1.Text.Substring (r-2));
               m = Convert.ToInt16(textBox1.Text.Substring(r- 5,2));
               h = Convert.ToInt16(textBox1.Text.Substring(r - 8,2));
            p = 150;
            q = 100;
            i = 0;
            while (i < 12)
            {    x1 = Math.Sin(2 * i * Math.PI / 12) * 55;
                y1 = Math.Cos(2 * i * Math.PI / 12) * 55;
                x0 = x1/55* 50;
                y0 = y1/55* 50;
                g.DrawLine(pen2, p   (float)x0, q   (float)y0, p   (float)x1, q   (float)y1);
                g.DrawEllipse(pen2, p - 60, q - 60, 120, 120);
                i = i   1;

            }
            i = j;
            x = Math.Sin(2 * i * Math.PI / 60) * 50;
            y = -Math.Cos(2 * i * Math.PI / 60) * 50;
            g.DrawLine(pen1, p   0, q   0, p   (float)x, q  (float)y);
            j  = 1;
         if (j == 60)
            {
                j = 0; m = m   1; 
             if (m == 60) { m = 0; h  = 1;

             if (h == 24) h = 0;
             }
            
          }
           
        if (j < 10) c = "0"; else c = "";      
        if (m < 10) b = "0"; else b = ""; 
         if (h < 10) a = "0"; else a = "";
            textBox1.Text = a Convert.ToString(h) ":" b Convert.ToString(m) ":" c  Convert.ToString(j);
                
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen pen1 = new Pen(Color.Red, 3);
            double x1, y1, i,x0,y0;
            float p,q;  
            p = 150;
            q = 100;
            i = 0;
           
         //  x1 = Math.Sin(2*i*Math.PI /60)*55;
         //  y1= Math.Cos(2*i * Math.PI / 60)*55;
         //   x0 = x1; y0 = y1;
          
          
            while (i < 12)
            {  

            x1 = Math.Sin(2 * i * Math.PI / 12) * 55;
            y1 = Math.Cos(2 * i * Math.PI / 12) * 55;
            x0 = Math.Sin(2 * i * Math.PI / 12) * 50;
            y0 = Math.Cos(2 * i * Math.PI / 12) * 50;
            g.DrawLine(pen1, p   (float)x0, q  (float)y0, p   (float)x1, q  (float)y1);
            g.DrawEllipse(pen1, p-60, q-60, 120, 120);
                i = i   1;
                Application.Exit();
           
            }
           
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
      
    }
}