日期:2014-05-20  浏览次数:22360 次

C# 串口实时心电图
我们的要求是1秒钟512个点,把这一秒钟的数据平均显示在1秒的5个大格子里,这个应该怎么控制X轴的移动呢?
我现在是每2毫秒刷新一次(画一个点)这样1秒只能画500个点,2秒刷新一次界面闪屏很厉害,请各位大侠指点1、2.我的基本代码是这样的
   private void Form1_Load(object sender, EventArgs e)
        {
              ptlist = new Point[this.pictureBox1.Width];
              Point pt;
              for (int i = 0; i < this.pictureBox1.Width; i++)
              {
                  pt = new Point();
                  pt.X = i;
                  pt.Y = 255;
                  ptlist[i] = pt;
               }        
            timer1.Enabled = true;
            timer1.Interval = 2;
        }
private void timer1_Tick(object sender, EventArgs e)
        {
          //pictureBox1画图区域
           //ptlist         
           //alECGFisrt接收到的心电数据
          DrawLineS(Color.Blue, pictureBox1, ptlist, alECGFisrt);

        }
public void DrawLineS(Color color,PictureBox picbox, Point[] ptlist, ArrayList alECGFisrt)
        {
          mybitmap = new Bitmap(picbox.Width, picbox.Height);//设定位图大小
            Graphics doublebufferg = Graphics.FromImage(mybitmap);//从位图上获取画布
            doublebufferg.Clear(Color.White);//用背景色刷新
            //pictureBox1填充为白色,便于显示图像 
            Rectangle rect = new Rectangle(0, 0, picbox.Width, picbox.Height);
          doublebufferg.FillRectangle(new SolidBrush(Color.White), rect);

          //画网格线
            SetXAxis(ref doublebufferg, picbox);
            SetYAxis(ref doublebufferg, picbox);
            ////绘制实时随机曲线
            Point temp = new Point();