日期:2014-05-17 浏览次数:21109 次
private void MainForm_Paint(object sender, PaintEventArgs e) { //画圆 Pen redPen = new Pen(Color.Red, 1); int n = 100;//n圆的直径 Rectangle r = new Rectangle(10, 10, n, n);//标识圆的大小 e.Graphics.DrawEllipse(redPen, r); //画圆心 Pen bluepen = new Pen(Color.Blue, 5); Rectangle rr = new Rectangle(r.Left + n / 2, r.Top + n / 2, 5, 5); e.Graphics.DrawEllipse(bluepen, rr); //画刻度 Point pN=new Point (r.Left+r.Height/2,r.Top);//12点钟刻度点 Point pS = new Point(r.Left + r.Height / 2, r.Top + r.Height);//6点钟刻度点 Point pW = new Point(r.Left, r.Top + r.Height / 2);//9点钟刻度点 Point pE = new Point(r.Right, r.Top + r.Height / 2);//3点钟刻度点 e.Graphics.DrawLine(bluepen, pN, new Point(pN.X, pN.Y + 5));//12点钟刻度 e.Graphics.DrawLine(bluepen, pE, new Point(pE.X-5, pE.Y));//3点钟刻度 e.Graphics.DrawLine(bluepen, pS, new Point(pS.X, pS.Y - 5));//6点钟刻度 e.Graphics.DrawLine(bluepen, pW, new Point(pW.X+5, pW.Y));//9点钟刻度 }