12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
-
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace OTSIncAReportGraph
- {
- /// <summary>
- /// 基本线类
- /// </summary>
- public class DisplaySegment : ICloneable
- {
-
- private RectangleF m_rect;
-
-
-
- private Color m_color;
-
- private float m_PenWidthAndHeight = 1;
-
-
- /// <summary>
- /// 克隆基本线
- /// </summary>
- /// <returns></returns>
- public object Clone()
- {
- var newSeg= new DisplaySegment();
- newSeg.m_rect = this.m_rect;
- newSeg.Color = this.Color;
-
- return newSeg;
- }
- public DisplaySegment()
- {
-
- }
-
- /// <summary>
- /// 画面的大小
- /// </summary>
- public RectangleF GetShowRect()
- { return m_rect; }
- /// <summary>
- /// 画面的大小
- /// </summary>
- public void SetShowRect(RectangleF value)
- { m_rect = value; }
-
-
-
- /// <summary>
- /// 线的颜色
- /// </summary>
- public Color Color
- {
- get { return m_color; }
- set { m_color = value; }
- }
-
- /// <summary>
- /// 绘制函数
- /// </summary>
- /// <param name="e"></param>
- public void OnPaint(PaintEventArgs e)
- {
-
-
- Pen p = new Pen(m_color, m_PenWidthAndHeight + 2f);//这里加1f的宽度后,用线组成多边形不会分散,效果正常,原因不知,但目前没有遇到问题
- e.Graphics.DrawLine(p, m_rect.X, m_rect.Y, m_rect.X + m_rect.Width, m_rect.Y);
-
- }
- }
- }
|