public override void WriteXml(XmlWriter writer) { TypeConverter colorConverter = TypeDescriptor.GetConverter(typeof(Color)); base.WriteXml(writer); writer.WriteElementString("KnobImage", KnobImage); writer.WriteStartElement("Positions"); foreach (RotarySwitchPosition position in Positions) { writer.WriteStartElement("Position"); writer.WriteAttributeString("Name", position.Name); writer.WriteAttributeString("Rotation", position.Rotation.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteElementString("DefaultPosition", DefaultPosition.ToString(CultureInfo.InvariantCulture)); if (DrawLines) { writer.WriteStartElement("Lines"); writer.WriteElementString("Thickness", LineThickness.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Length", LineLength.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Color", colorConverter.ConvertToInvariantString(LineColor)); writer.WriteEndElement(); } if (DrawLabels) { writer.WriteStartElement("Labels"); writer.WriteElementString("Color", colorConverter.ConvertToInvariantString(LabelColor)); writer.WriteElementString("MaxWidth", MaxLabelWidth.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("MaxHeight", MaxLabelHeight.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Distance", LabelDistance.ToString(CultureInfo.InvariantCulture)); LabelFormat.WriteXml(writer); writer.WriteEndElement(); } writer.WriteStartElement("ClickType"); writer.WriteElementString("Type", ClickType.ToString()); if (ClickType == Controls.ClickType.Swipe) { writer.WriteElementString("Sensitivity", SwipeSensitivity.ToString(CultureInfo.InvariantCulture)); } writer.WriteEndElement(); writer.WriteElementString("MouseWheel", MouseWheelAction.ToString(CultureInfo.InvariantCulture)); }
/// <summary> /// Chart 설정 또는 변량에 대해 XML 속성으로 생성합니다. /// </summary> /// <param name="writer">xml writer</param> public override void GenerateXmlAttributes(System.Xml.XmlWriter writer) { base.GenerateXmlAttributes(writer); if (EnableSmartLabels.HasValue) { writer.WriteAttributeString("EnableSmartLabels", EnableSmartLabels.GetHashCode().ToString()); } if (SkipOverlapLabels.HasValue) { writer.WriteAttributeString("SkipOverlapLabels", SkipOverlapLabels.GetHashCode().ToString()); } if (IsSmartLineSlanted.HasValue) { writer.WriteAttributeString("IsSmartLineSlanted", IsSmartLineSlanted.GetHashCode().ToString()); } if (SmartLineColor.HasValue) { writer.WriteAttributeString("SmartLineColor", SmartLineColor.Value.ToHexString()); } if (SmartLineThickness.HasValue) { writer.WriteAttributeString("SmartLineThickness", SmartLineThickness.ToString()); } if (SmartLineAlpha.HasValue) { writer.WriteAttributeString("SmartLineAlpha", SmartLineAlpha.ToString()); } if (LabelDistance.HasValue) { writer.WriteAttributeString("LabelDistance", LabelDistance.ToString()); } if (SmartLabelClearance.HasValue) { writer.WriteAttributeString("SmartLabelClearance", SmartLabelClearance.ToString()); } }