资 源 简 介
资源描述本源程序是基于C#的时钟设计,能为初学者提供参考价值,为初学者提供基本的编写代码思路,
namespace Clock
{
public partial class MainForm : Form
{
private PointF center;
private float r;
private Pen hourPen;
private Pen minutePen;
private Pen secondPen;
private Thread timeThread;
public MainForm()
{
InitializeComponent();
ShowInTaskbar = false;//不在任务栏中显示
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint,true);
SetStyle(ControlStyles.AllPaintingInWmPaint,true);
center = new PointF(ClientSize.Width/ 2.0f, ClientSize.Height/ 2.0f);
r = Math.Min(ClientSize.Width / 2.0f, ClientSize.Height / 2.0f);
hourPen = new Pen(Color.Black, 2.5f);
minutePen = new Pen(Color.Black, 1.5f);
secondPen = new Pen(Color.Black, 0.5f);
timeThread=new Thread(new ThreadStart(DrawTime));
timeThread.Start();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
g.Clear(BackColor);
//g.SmoothingMode =