Пример #1
0
        /*public override void GeneralSvg(XmlElement g, Point translate, Font font)
         * {
         *  //base.GeneralSvg(g);
         *  Shape shaper = Shape.GetShaper(TopicShape.Rectangle, 2);
         *  if (shaper != null)
         *  {
         *      Rectangle rect = Bounds;
         *      rect.Offset(translate);
         *      rect.Inflate(0, -2);
         *      XmlElement node = shaper.GenerateSvg(rect, g, Color.Empty, BackColor);
         *      g.AppendChild(node);
         *
         *      if (Value > 0 && Maximum > Minimum)
         *      {
         *          rect.Inflate(-1, -1);
         *          rect.Width = (int)Math.Ceiling(rect.Width * (Math.Min(Maximum, Value) - Minimum) / (Maximum - Minimum));
         *          if (rect.Width > 0 && rect.Height > 0)
         *          {
         *              node = shaper.GenerateSvg(rect, g, Color.Empty, Color);
         *              g.AppendChild(node);
         *          }
         *      }
         *  }
         *
         *  // text
         *  if (ShowText)
         *  {
         *      string text = string.Format("{0}%", Value);
         *      Rectangle rect = Bounds;
         *      rect.Offset(translate);
         *      Blumind.Core.Exports.SvgEngine.ExportText(text, ForeColor, font, g, rect);
         *  }
         * }*/

        public override void Serialize(XmlDocument dom, XmlElement node)
        {
            base.Serialize(dom, node);

            node.SetAttribute("max", Maximum.ToString());
            node.SetAttribute("min", Minimum.ToString());
            node.SetAttribute("value", Value.ToString());
            node.SetAttribute("show_text", ShowText.ToString());
            node.SetAttribute("auto_calculation", AutoCalculation.ToString());
            //node.SetAttribute("visible", Visible.ToString());
            if (!Color.IsEmpty)
            {
                node.SetAttribute("color", ST.ToString(Color));
            }
            if (!BackColor.IsEmpty)
            {
                node.SetAttribute("back_color", ST.ToString(BackColor));
            }
            if (!ForeColor.IsEmpty)
            {
                node.SetAttribute("fore_color", ST.ToString(ForeColor));
            }
        }