代码如下:
        private void drawClock(int h, int m, int s)
        {          
            Graphics graphic = this.CreateGraphics();
            Rectangle rect = new Rectangle(30, 76, 180, 180);            graphic.Clear(Color.White);            Pen myPen = new Pen(Color.Black, 1);
            graphic.DrawEllipse(myPen, rect.Width/2,rect.Height/2,180,180);//画表盘
        }
不知道为什么表盘总是画不出来

解决方案 »

  1.   

    最后一句输错了,
    应该是:
    graphic.DrawEllipse(myPen, rect.Width/2+30,rect.Height/2+76,180,180);//画表盘
    不过还是不能画出来
      

  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 WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private void drawClock()
            {
                Graphics graphic = this.CreateGraphics();
                Rectangle rect = new Rectangle(30, 76, 180, 180);            graphic.Clear(Color.White);            Pen myPen = new Pen(Color.Black, 1);
                graphic.DrawEllipse(myPen, rect.Width / 2, rect.Height / 2, 180, 180);//画表盘
            }        private void Form1_Paint(object sender, PaintEventArgs e)
            {
                drawClock();
            }
        }
    }