public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("ShapeId", ShapeId); info.AddValue("CurrentShape", CurrentShape); info.AddValue("BrushType", BrushType); info.AddValue("PenType", PenType); info.AddValue("Width", ShapeSize.Width); info.AddValue("Height", ShapeSize.Height); info.AddValue("X", ShapeLoc.X); info.AddValue("Y", ShapeLoc.Y); info.AddValue("PenColor", PenColor.ToArgb()); info.AddValue("BrushColor", BrushColor.ToArgb()); info.AddValue("IsBrush", IsBrush); }
public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Ellipse")); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("name")).Value = Name; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("color")).Value = Color.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("brushColor")).Value = BrushColor.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("brushAlpha")).Value = BrushAlpha.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("BuildTangent")).Value = BuildTangent.ToString(); for (int i = 0; i < points.Count; i++) { var nodePoint = node.AppendChild(parentNode.OwnerDocument.CreateElement(string.Format("point{0}", i))); var time = owner.chart.StockSeries.GetCandleOpenTimeByIndex((int)Math.Round(points[i].X)); nodePoint.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("time")).Value = time.ToString("ddMMyyyy HHmmss", CultureProvider.Common); nodePoint.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("price")).Value = points[i].Y.ToString(CultureProvider.Common); } }