public static Create ( FontStyleFlags flags = FontStyleFlags.Regular ) : |
||
flags | FontStyleFlags | The style flags information applied to text. |
Результат |
/// <summary> /// Creates a new <see cref="TextStyle"/> instance. /// </summary> /// <param name="name">The text style name.</param> /// <param name="fontName">The font name.</param> /// <param name="fontFile">The font file path.</param> /// <param name="fontSize">The font size.</param> /// <param name="fontStyle">The font style.</param> /// <param name="textHAlignment">The text horizontal alignment.</param> /// <param name="textVAlignment">The text vertical alignment.</param> /// <returns>The new instance of the <see cref="TextStyle"/> class.</returns> public static TextStyle Create(string name = "", string fontName = "Calibri", string fontFile = @"C:\Windows\Fonts\calibri.ttf", double fontSize = 12.0, FontStyle fontStyle = null, TextHAlignment textHAlignment = TextHAlignment.Center, TextVAlignment textVAlignment = TextVAlignment.Center) { return(new TextStyle() { Name = name, FontName = fontName, FontFile = fontFile, FontSize = fontSize, FontStyle = fontStyle ?? FontStyle.Create(FontStyleFlags.Regular), TextHAlignment = textHAlignment, TextVAlignment = textVAlignment }); }
/// <summary> /// Parses a font style string. /// </summary> /// <param name="s">The font style string.</param> /// <returns>The <see cref="FontStyle"/>.</returns> public static FontStyle Parse(string s) { var flags = (FontStyleFlags)Enum.Parse(typeof(FontStyleFlags), s, true); return(FontStyle.Create(flags)); }