示例#1
0
        FormattedText GetFormattedText(string text, Font font, TextAlignment alignment = TextAlignment.Left)
        {
            var formattedText = new FormattedText(text, CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, font.GetTypeface(), font.Size, null);

            return(formattedText);
        }
示例#2
0
        public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null)
        {
            var formattedText = new FormattedText(text, CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, font.GetTypeface(), font.Size, null);

            formattedText.SetForegroundBrush(brush?.GetBrush());
            dc.DrawText(formattedText, frame.BottomLeft.GetPoint());
        }