Ejemplo n.º 1
0
 /// <summary>
 /// 获取所有绘制的线
 /// </summary>
 /// <returns>绘制的线数组</returns>
 public CharLine[] GetAllLine()
 {
     this.CheckInvokeRequired();
     CharLine[] lines = new CharLine[this._htLine.Count];
     this._htLine.Values.CopyTo(lines, 0);
     return(lines);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 移除指定绘制的线
        /// </summary>
        /// <param name="line">线</param>
        public void RemoveLine(CharLine line)
        {
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            this.RemoveLineById(line.Id);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加要绘制的线
        /// </summary>
        /// <param name="line">要绘制的线</param>
        public void AddLine(CharLine line)
        {
            this.CheckInvokeRequired();
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }

            if (this._htLine.ContainsKey(line.Id))
            {
                throw new ArgumentException($"已存在标识为[{line.Id}]的线");
            }

            this._htLine.Add(line.Id, line);
            this.CustomerPaint();
        }
Ejemplo n.º 4
0
        private void LeftToRightDrawLine(Graphics graphics, CharLine channel, float pointDistance, float width, float height)
        {
            //绘制使用率线
            var values = channel.ValueList;

            if (values.Count > 1)
            {
                var   usageLinePen = channel.LinePen;
                var   points = new PointF[values.Count];
                float vx = 0, vy;
                for (int i = values.Count - 1; i >= 0; i--)
                {
                    vy        = height - values[i] * height / 100;
                    points[i] = new PointF(vx, vy);
                    vx        = vx + pointDistance;
                    if (vx - width > _PRE)
                    {
                        break;
                    }
                }

                graphics.DrawLines(usageLinePen, points);
            }
        }