Example #1
0
        /// <summary>
        /// 画图
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (this.DesignMode)
            {
                ///Y坐标轴
                _mainPanel.YAxisList.Clear();
                _mainPanel.YAxisList.Add(new MedAxis(this.Font, Brushes.Black, 100, 0, 20));
                _mainPanel.YAxisList.MinSetp   = 1;
                _mainPanel.YAxisList.Pen.Color = Color.Black;

                ///X坐标轴
                _mainPanel.XAxisList.Clear();
                MedAxis axis = new MedAxis(this.Font, Brushes.Black, 10, 1, 1f);
                _mainPanel.XAxisList.Add(axis);
                _mainPanel.XAxisList.MinSetp   = 1;
                _mainPanel.XAxisList.Pen.Color = Color.Black;

                ///其他属性
                _mainPanel.LeftMargin      = 10;
                _mainPanel.BottomMargin    = 20;
                _mainPanel.RectBorderPen   = Pens.Gray;
                _mainPanel.HasAxisGridLine = false;
                _mainPanel.XAxisTitleAtTop = false;

                _mainPanel.CurveList.Clear();
                MedPointList points = new MedPointList();
                points.Add(1, 10);
                points.Add(2, 40);
                points.Add(3, 20);
                points.Add(4, 80);
                points.Add(5, 50);
                points.Add(6, 70);
                points.Add(7, 60);
                points.Add(8, 100);
                points.Add(9, 90);
                points.Add(10, 0);
                MedCurve curve = new MedCurve(points);
                _mainPanel.CurveList.Add(curve);
            }

            ///隐藏滚动条

            ///如果没有坐标轴则不作图
            if ((_mainPanel.XAxisList.Count == 0) || (_mainPanel.YAxisList.Count == 0))
            {
                return;
            }

            _mainPanel.DrawGraph(e.Graphics);

            ///绘制光标位置
            if (_drawcursorpos)
            {
                DrawCursorPos(e.Graphics);
            }
        }
Example #2
0
        public MedPointList SubPoints(float minvalue, float maxvalue)
        {
            MedPointList points = new MedPointList();

            foreach (MedPoint point in _points)
            {
                if ((point.X >= minvalue) && (point.X < maxvalue))
                {
                    points.Add(point.X, point.Y);
                }
            }
            return(points);
        }