界面效果:


对外提供的属性设置

        /// <summary>
        /// 背景色
        /// </summary>
        public Color BackColor;

        /// <summary>
        /// 边框颜色
        /// </summary>
        , , );

        /// <summary>
        /// 线条颜色
        /// </summary>
        , , );

        /// <summary>
        /// 折线颜色
        /// </summary>
        , , );

        /// <summary>
        /// 是否显示控件边框
        /// </summary>
        public bool rect_isvisable = false;
       /// <summary>
        /// 边框线宽
        /// </summary>
        ;

        /// <summary>
        /// 垂直线条间距
        /// </summary>
        ;
        /// <summary>
        /// 水平线条间距
        /// </summary>
        ;

        /// <summary>
        /// 点密度,越小越稀疏
        /// </summary>
        private float point_density = 0.7f;

        #region
        public float Point_density
        {
            get
            {
                return point_density;
            }

            set
            {
                point_density = value;

                 || value > )
                {
                    point_density = 0.7f;
                }
            }
        }

        public float Linewidth
        {
            get
            {
                return linewidth;
            }

            set
            {
                linewidth = value;
                )
                {
                    linewidth = ;
                }
            }
        }

        public int Vertical_spacing
        {
            get
            {
                return vertical_spacing;
            }

            set
            {
                )
                {
                    value = ;
                }
                vertical_spacing = value;
            }
        }

        public int Horizontal_spacing
        {
            get
            {
                return horizontal_spacing;
            }

            set
            {
                )
                {
                    value = ;
                }
                horizontal_spacing = value;
            }
        }

        #endregion

这些要保证是大于0,我使用属性了,这样比频繁的类型转换要好


绘制

        protected override void OnPaint(PaintEventArgs pe)
        {
            this.drawtable();
            this.drawpolygonal();
            base.OnPaint(pe);
        }

        private void drawtable()//表格绘制
        {

            if (this.rect_isvisable)
            {
                this.rectanglelinecolor = Color.Black;
            }
            else
            {
                this.rectanglelinecolor = this.BackColor;
            }
            Graphics g = this.CreateGraphics();
            g.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);

            )+this.vertical_spacing;i<this.Height;i+=this.vertical_spacing)
            {
                g.DrawLine(), this.ClientRectangle.X, i, this.Width, i);
            }

            )+this.Horizontal_spacing;i<this.Width;i+=this.Horizontal_spacing)
            {
                g.DrawLine(), i,this.ClientRectangle.Y,i,  this.Height);
            }
            g.DrawRectangle(, , this.Width - this.linewidth, this.Height - this.linewidth);
            g.Dispose();
        }

        /// <summary>
        /// 折线绘制
        /// </summary>
        private void drawpolygonal()
        {
            Point ps=new Point();
            Point pe;

            Graphics g = this.CreateGraphics();
            ,j=; i>=;i--,j++)
            {
                float f = this.polygonalpoint[i];
                int w = this.Width - this.Horizontal_spacing_per_pp*j;
                int h = this.Height - (int)(f * this.Height);
                pe = ps;
                ps = new Point(w, h);
                )
                {
                    g.DrawLine(p,pe, ps);
                }

            }
        }

链接:http://pan.baidu.com/s/1gdjod8J

添加到自己的项目里拖进去就可以了;和普通的控件一样使用

M$自己也有更好的linechart,不过插件肯定比较大的了

最新文章

  1. web项目启动报错Unknown character set: &#39;utf8mb4&#39; in mysql
  2. 数据库知识整理&lt;三&gt;
  3. 无侵入方面编程-用HttpModule+SoapExtension监视页面执行参数(二)
  4. Nginx初始化过程总结
  5. hadoop中HBase子项目入门讲解
  6. sc.exe管理系统服务
  7. java学习面向对象之抽象类
  8. js中的apply call 操作小结(参考自网络)
  9. android支付宝支付开发过程
  10. Apache 的常见问题
  11. RESTful API接口文档规范小坑
  12. Mac终端工具item2实现覆盖在屏幕上透明效果
  13. linux权限相关操作
  14. pass parameter by endpoint, this is for websocket
  15. Spark操作实战
  16. Python 基础数据类型之set
  17. 0422“数学口袋精灵”BUG发现
  18. docker commit 显示“invalid reference format”
  19. 决策树在sklearn中的实现
  20. usaco-2.2.2Subset Sums 集合

热门文章

  1. 【Android】第三方库使用的问题集
  2. ASP.NET动态网站制作(0)
  3. Ubuntu 12.04中文输入法的安装(zhuan)
  4. [nio]dawn的基本概念
  5. DIV+CSS一些小小的技巧
  6. python 基础 1.3 使用pycharm给python传递参数及pycharm调试模式
  7. POJ2594 Treasure Exploration[DAG的最小可相交路径覆盖]
  8. 【oracle案例】ORA-01102: cannot mount database in EXCLUSIVE mode
  9. 【题解】P2279消防局的设立
  10. Linux下监视GPU、CPU的使用情况