コード例 #1
0
 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);
 }
コード例 #2
0
        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;
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 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));
 }
コード例 #5
0
 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));
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 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));
 }
コード例 #8
0
ファイル: Styles.cs プロジェクト: CHiiLD/net-toolkit
 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);
 }