public static TextBlock AddText(this Canvas canvas, Rect rect, String text, TextStyle textStyle) { return AddText(canvas, rect.Left, rect.Top, rect.Width, rect.Height, text, textStyle); }
public static TextBlock AddText(this Canvas canvas, double x, double y, double width, double height, String text, TextStyle textStyle) { TextBlock textBlock = new TextBlock() { Width = width, Height = height, Text = text, Foreground = textStyle.TextColor, FontSize = textStyle.FontSize, TextWrapping = TextWrapping.Wrap, TextAlignment = textStyle.Alignment, VerticalAlignment = VerticalAlignment.Center }; if (textStyle.Bold) { textBlock.FontWeight = FontWeights.Bold; } if (textStyle.Italic) { textBlock.FontStyle = FontStyles.Italic; } Canvas.SetLeft(textBlock, x); Canvas.SetTop(textBlock, y); canvas.Children.Add(textBlock); return textBlock; }
public static TextBlock AddText(this Canvas canvas, Point position, Size size, String text, TextStyle textStyle) { return AddText(canvas, position.X, position.Y, size.Width, size.Height, text, textStyle); }
public static TextBlock AddText(this Canvas canvas, Rect rect, String text, TextStyle textStyle) { return(AddText(canvas, rect.Left, rect.Top, rect.Width, rect.Height, text, textStyle)); }
public static TextBlock AddText(this Canvas canvas, Point position, Size size, String text, TextStyle textStyle) { return(AddText(canvas, position.X, position.Y, size.Width, size.Height, text, textStyle)); }
public static TextBlock AddText(this Canvas canvas, double x, double y, double width, double height, String text, TextStyle textStyle) { TextBlock textBlock = new TextBlock() { Width = width, Height = height, Text = text, Foreground = textStyle.TextColor, FontSize = textStyle.FontSize, TextWrapping = TextWrapping.Wrap, TextAlignment = textStyle.Alignment, VerticalAlignment = VerticalAlignment.Center }; if (textStyle.Bold) { textBlock.FontWeight = FontWeights.Bold; } if (textStyle.Italic) { textBlock.FontStyle = FontStyles.Italic; } Canvas.SetLeft(textBlock, x); Canvas.SetTop(textBlock, y); canvas.Children.Add(textBlock); return(textBlock); }
protected bool Equals(TextStyle other) { return(Equals(TextColor, other.TextColor) && FontSize.Equals(other.FontSize) && Bold.Equals(other.Bold) && Italic.Equals(other.Italic) && Alignment.Equals(other.Alignment)); }
protected bool Equals(TextStyle other) { return Equals(TextColor, other.TextColor) && FontSize.Equals(other.FontSize) && Bold.Equals(other.Bold) && Italic.Equals(other.Italic) && Alignment.Equals(other.Alignment); }