{
public enum ShapeTypes
Rectangle=1,
Line=2,
Ellipse=3,
Pie=4
};
public enum GradientTypes
Horizontal=1,
Vertical=2,
ForwardDiagonal=3,
BackwardDiagonal=4,
None=5
private string sID = "";
private string sCoords = "";
private string sColor = "#ffffff";
private string sColor2 = "#ffffff";
private int iPenWidth = 1;
private int iStartAngle = 0;
private int iSweepAngle = 0;
private ShapeTypes iType = ShapeTypes.Rectangle;
private GradientTypes iGradient = GradientTypes.None;
XmlElement tmpXel;
XmlNode tmpNode;
//--------------------------------
public TsmlShape(string coords)
iType = ShapeTypes.Rectangle;
iGradient = GradientTypes.None;
sColor = "#ffffff";
sColor2 = "#ffffff";
iPenWidth = 1;
iStartAngle = 0;
iSweepAngle = 0;
sCoords = coords;
}
public TsmlShape(string coords, ShapeTypes type)
iType = type;
public TsmlShape(string coords, ShapeTypes type, string color)
sColor = color;
public TsmlShape(string coords, ShapeTypes type, string color, int penwidth)
iPenWidth = penwidth;
public TsmlShape(string coords, ShapeTypes type, string color, string color2, GradientTypes gradient)
iGradient = gradient;
sColor2 = color2;
public TsmlShape(string coords, ShapeTypes type, string color, string color2, GradientTypes gradient, int penwidth, int startangle, int sweepangle)
iStartAngle = startangle;
iSweepAngle = sweepangle;
/// <summary>
/// Declare an explicit conversion from a TsmlShape to an TsmlElement:
/// </summary>
/// <param name="roman"></param>
/// <returns></returns>
static public implicit operator TsmlElement(TsmlShape shp)
TsmlElement el = new TsmlElement(shp.TagName);
el.Coords = shp.Coords;
el.Color = shp.Color;
el.Color2 = shp.Color2;
el.Gradient = shp.Gradient;
el.PenWidth = shp.PenWidth;
el.ShapeType = shp.Type;
el.StartAngle = shp.StartAngle;
el.SweepAngle = shp.SweepAngle;
el.ID = shp.ID;
return el;
public string TagName
get{ return "shape"; }
public string Coords
get{ return sCoords; }
set{
sCoords = value;
tmpXel.SetAttribute("coords", value);
tmpNode = (XmlElement) tmpXel;
public ShapeTypes Type
get{ return iType; }
iType = value;
tmpXel.SetAttribute("type", value.ToString());
public GradientTypes Gradient
get{ return iGradient; }
iGradient = value;
tmpXel.SetAttribute("gradient", value.ToString());
public int PenWidth
get{ return iPenWidth; }
iPenWidth = value;
tmpXel.SetAttribute("penwidth", value.ToString());
public int StartAngle
get{ return iStartAngle; }
iStartAngle = value;
public int SweepAngle
get{ return iSweepAngle; }
iSweepAngle = value;
tmpXel.SetAttribute("sweepangle", value.ToString());
public string Color
get{ return sColor; }
sColor = value;
tmpXel.SetAttribute("color", value);
public string Color2
get{ return sColor2; }
sColor2 = value;
tmpXel.SetAttribute("color2", value);
public string ID
get{ return sID; }
sID = value;
tmpXel.SetAttribute("ID", value);