首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

新手关于GDI+画心电图的显示有关问题

2013-01-23 
新手关于GDI+画心电图的显示问题以下是我显示出4S心电数据图的代码using Systemusing System.Collections

新手关于GDI+画心电图的显示问题
以下是我显示出4S心电数据图的代码

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;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Threading;
using System.Globalization;
using Server;
using ZedGraph;



namespace Server
{
    public partial class Pic : Form
    {
        
        public Pic()
        {
            InitializeComponent();
            //this.Size = new System.Drawing.Size(700,500);
            this.AutoScrollMinSize = new Size(700, 500);//设置自动滚动的最小尺寸
        }
        public string OpenFilePath;

        private void Pic_Load(object sender, EventArgs e)
        {
           // panel1.Width = 900;
           // panel1.Height =500;
            pictureBox1.Width =1440;
            pictureBox1.Height =600;
          //  pictureBox1.Location = new Point(0, 0);


        }

        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = pictureBox1.CreateGraphics();

            g.ScaleTransform(1.0f,-1.0f);   //翻转函数(所有 Y轴的方面 记得 加负号)
            Pen pen = new Pen(Color.Red);
            byte[] rdata = new byte[2048];//设置2k的读取缓冲区
            Stream stream = File.OpenRead(OpenFilePath);//流文件实例
            BinaryReader bread = new BinaryReader(stream);//读取文件
            bread.Read(rdata, 0, 1440);//读出的是10进制数据
            bread.Close();
            PointF[] pY = new PointF[1440];
            PointF[] pL = new PointF[1440];
            PointF pt; 
            for (int i = 0; i <1440; i++)
            {


                //pY[i] = new PointF(i , rdata[i]/10f+200);
                pL[i] = new PointF(i, -200);
                float fx = (float ) i;
                float fy = (float ) rdata[i];
                pt = new PointF(fx, fy-400);
               
                pY[i] = pt;
               
            }
                 g.DrawLines(pen,pY);
                g.DrawLines(pen, pL);
                g.Dispose();
        }

    }
}
为什么我显示出来的心电 图是这样???新手关于GDI+画心电图的显示有关问题
正常显示效果应该是
新手关于GDI+画心电图的显示有关问题
求 大神帮我看看是什么 问题???
[解决办法]
你画了两套,一套是两点之间连线,另一套是每个数据点从0到当前值。后者的数据比前者大一倍。
[解决办法]
去掉  g.DrawLines(pen, pL);
[解决办法]
你画了两套,一套是两点之间连线,另一套是每个数据点从0到当前值。后者的数据比前者大一倍。 

热点排行