public struct RectArea
{
public Point LeftTop;
public Point RightBottom;
}
public struct DrawPara
{
public Color color;
public DashStyle style;
public int lineWidth;
public DrawPara(Color color1, DashStyle style1, int lineWidth1)
{
color = color1;
style = style1;
lineWidth = lineWidth1;
}
}
// 接口类
interface IgraphicsOp
{
void Move(int x, int y, Graphics g);
void MoveTo(int x, int y, Graphics g);
void Draw(Graphics g);
}
// 图元基类
public abstract class Elements : ICloneable,IgraphicsOp
{
public DrawPara para;
public Elements(DrawPara para1)
{
para = para1;
}
public Elements()
{
}
public DrawPara Para
{
get
{
return Para;
}
set
{
Para = value;
}
}
public abstract decimal Area();
public abstract RectArea OverRect();
public abstract void _Move(int x, int y);
public abstract void _MoveTo(int x, int y);
public abstract void Draw(Graphics g);
public void Move(int x, int y, Graphics g)
{
Color oldColor = this.para.color;
//this.para.color = new Pen(this.para.color, this.para.lineWidth);
Draw(g);
_Move(x, y);
this.para.color = oldColor;
Draw(g);
}
public void MoveTo(int x, int y, Graphics g)
{
Color oldColor = this.para.color;
//this.para.color = new Pen(this.para.color, this.para.lineWidth);
Draw(g);
_MoveTo(x, y);
this.para.color = oldColor;
Draw(g);
}
public virtual object Clone()
{
return MemberwiseClone();
}
}
// 直线类
public abstract class Line : Elements
{
private Point start, end;