博客
关于我
C#更新数组实现动态曲线
阅读量:668 次
发布时间:2019-03-15

本文共 2102 字,大约阅读时间需要 7 分钟。

 
private void timer定时_Tick(object sender, EventArgs e)        {            if (Flash == 0)          //当刷新时            {                Pen middleLine = new Pen(Color.White);                SolidBrush blackBrush = new SolidBrush(Color.Black);   //定义了一个单色的黑色画笔                graphic = Graphics.FromImage(pictureBox图像.Image);                graphic.FillRectangle(blackBrush, 0, 0, 500, 251);     //将画布填充为黑色矩形                            Point pt1 = new Point(0, 125);          //中间线的两点                Point pt2 = new Point(500, 125);                graphic.DrawLine(middleLine, pt1, pt2);        //画中间线            }            Random random = new Random();            pointList = new Point[50];    //实例化坐标数组*            int data = random.Next(-800, 800);   //生成一个随机数           // Point p;       //申明一个坐标变量            for (int i = 1; i <50 ; i++)         //更新数组            {                N[i - 1] = N[i];                pointList[i - 1] = pointList[i];      //更新点的坐标            }            N[49] = data;            pointList[49].X = 49 * time;            pointList[49].Y = data;                             if (Flash == 0)            {                if (Flash == 0)                {                    int k1 = 0, k2 = 0;                    for (int i = 0; i < 49; i++)                    {                        k1 = (int)(lineD - N[i] / times);                        k2 = (int)(lineD - N[i + 1] / times);                        graphic.FillEllipse(new SolidBrush(Color.Red), (i * time), k1, 4, 4);   //填充边框所定义的椭圆内部,由椭圆边框左上角坐标和椭圆宽度和高度组成                        //graphic.DrawLine(new Pen(Color.FromArgb(255, 255, 0), 1), new Point(i * time, k1), new Point((i + 1) * time, k2));   //两点之间连线                        pointList[i].X = i * time;  pointList[i].Y = k1;                     }                    graphic.FillEllipse(new SolidBrush(Color.Red), (49 * time), k2, 4, 4);                    graphic.DrawCurve(new Pen(Color.FromArgb(255, 255, 0), 1), pointList, 0.5f);                                       }                pictureBox图像.Refresh();                 //刷新picturebox            }       }

 

 

 

转载地址:http://iaamz.baihongyu.com/

你可能感兴趣的文章
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>
Mysql8.0注意url变更写法
查看>>
Mysql8.0的特性
查看>>
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
MySQL8修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>