using System;
using System.Drawing;
using System.Windows.Forms;
namespace OTSIncAReportGraph
{
///
/// 基本线类
///
public class DisplaySegment : ICloneable
{
private RectangleF m_rect;
private Color m_color;
private float m_PenWidthAndHeight = 1;
///
/// 克隆基本线
///
///
public object Clone()
{
var newSeg= new DisplaySegment();
newSeg.m_rect = this.m_rect;
newSeg.Color = this.Color;
return newSeg;
}
public DisplaySegment()
{
}
///
/// 画面的大小
///
public RectangleF GetShowRect()
{ return m_rect; }
///
/// 画面的大小
///
public void SetShowRect(RectangleF value)
{ m_rect = value; }
///
/// 线的颜色
///
public Color Color
{
get { return m_color; }
set { m_color = value; }
}
///
/// 绘制函数
///
///
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);
}
}
}