对了 这是我form里的代码
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 时钟
{
public partial class Form1 : Form
{
Pointer[] pts;
public Form1()
{
InitializeComponent();
int widthSize = this.ClientSize.Width / 2;
int heightSize = this.ClientSize.Height / 2;
pts = new Pointer[3];
Point start = new Point(widthSize, heightSize);
pts[0] = new SecondPointer(widthSize,new Pen(Color.Red, 1.5f),start);
pts[1] = new HourPointer(widthSize*0.6, new Pen(Color.Black, 3.0f), start);
pts[2] = new MinutePoniter((widthSize*0.75), new Pen(Color.Blue, 2.0f), start);
}
private void timer1_Tick(object sender, EventArgs e)
{
foreach (Pointer pt in pts )
{
pt.Move();
}
this.Invalidate();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
foreach(Pointer pt in pts )
{
pt.show(e.Graphics);
}
}