日期:2014-05-19  浏览次数:20866 次

请求那位大大给个用C#编写的钟表程序
谢谢大大们来帮助

------解决方案--------------------
参考一下,手输入的,可能会有错误
//定义秒针,分针,时针的长度
private const int s_pinlen=75;
private const int m_pinlen=50;
private const int h_pinlen=25;
private void MyDrawClock(int h,int m,int s)
{
Graphics g=this.CreateGraphics();
Rectangle rect=this.ClientRectangle();
rect=new Rectangle(this.ClientRectangle.Right-250,this.ClientRectange.Bottom-230,150,150);
g.Clear(Color.White);

Pen myPen=new Pen(Color.Bule,1);
//绘制表盘
g.DrawEllipse(myPen,rect);

//表中心点
Point centerPoint=new Point(this.ClientRectangle.Width/2,this.ClientRectangle.Height/2);

//计算出秒针,分针,时针的外端点
Point secPoint=new Point((int)(centerPoint.X+(Math.Sin(6*s*Math.PI/180))*s_pinlen),(int)(centerPoint.Y-(Math.Cos(6*s*Math.PI/180))*s_pinlen));

Point minPoint=new Point((int)(centerPoint.X+(Math.Sin(6*s*Math.PI/180))*m_pinlen),(int)(centerPoint.Y-(Math.Cos(6*s*Math.PI/180))*m_pinlen));

Point hourPoint=new Point((int)(centerPoint.X+(Math.Sin(6*s*Math.PI/180))*h_pinlen),(int)(centerPoint.Y-(Math.Cos(6*s*Math.PI/180))*h_pinlen));

g.DrawLine(myPen,centerPoint,secPoint);

myPen=new Pen(Color.Green,2);
g.DrawLine(myPen,centerPoint,minPoint);

myPen=new Pen(Color.Red,4);
g.DrawLine(myPen,centerPoint,hourPoint);
}
------解决方案--------------------
┌──┐
│顶你│ ╭───────╮
 └──┘  ┏━━━━━━━┓ │ 既然有分, │
  ┏┓  ┏┫    |||┣┓∠ 这贴就顶了 │
  ┣┫  ┗┫━━ ┃ ━━┣┛ ╰───────╯
┏┳┫┣┳┓ ┃ ━━━━━ ┃
┃    ┃ ┗━━━┳━━━┛
┗━━━━┻━━━━▇▇▇┛ ()000o
          ┃ ┃  (````)
          ┃ ┃   )``/
          ┛ ┗━━(__/