/// <summary> /// Helper method to generate an XML object from a <see cref="SongTextFormatting"/> object. /// </summary> /// <param name="formatting">The formatting object.</param> /// <param name="elementName">The element name to generate.</param> /// <returns>The generated XML.</returns> private static XElement WriteTextFormatting(SongTextFormatting formatting, string elementName) { return(new XElement(elementName, new XElement("name", formatting.Name), new XElement("size", formatting.Size), new XElement("bold", formatting.Bold.ToString().ToLower()), new XElement("italic", formatting.Italic.ToString().ToLower()), new XElement("color", ComputeColor(formatting.Color)), new XElement("outline", formatting.Outline), new XElement("shadow", formatting.Shadow) )); }
public ChooseFontControl() { InitializeComponent(); FontComboBox.SelectionChanged += (sender, args) => { var font = this.Font; font.Name = ((FontFamily)FontComboBox.SelectedItem).Source; this.Font = font; }; ColorPicker.SelectedColorChanged += (sender, args) => { var col = ColorPicker.SelectedColor; var font = this.Font; font.Color = System.Drawing.Color.FromArgb(col.R, col.G, col.B); this.Font = font; }; }
/// <summary> /// Helper method to generate an XML object from a <see cref="SongTextFormatting"/> object. /// </summary> /// <param name="formatting">The formatting object.</param> /// <param name="elementName">The element name to generate.</param> /// <returns>The generated XML.</returns> private static XElement WriteTextFormatting(SongTextFormatting formatting, string elementName) { return new XElement(elementName, new XElement("name", formatting.Name), new XElement("size", formatting.Size), new XElement("bold", formatting.Bold.ToString().ToLower()), new XElement("italic", formatting.Italic.ToString().ToLower()), new XElement("color", ComputeColor(formatting.Color)), new XElement("outline", formatting.Outline), new XElement("shadow", formatting.Shadow) ); }