I use DrawTextfor drawing FormattedTexton Visual Layer. Now I use the code below to define formatted text, and I can set TextAlignmentto Center. But what about VerticalAlignment? As you can see in the image below, the center of the text is not at the center point , which is displayed with a red dot here.
The part where I define FormattedText:
var ft = new FormattedText("A",
CultureInfo.GetCultureInfo("en-us"),
FlowDirection.LeftToRight,
new Typeface("Verdana"),
36, Brushes.Yellow);
ft.TextAlignment = TextAlignment.Center;
The part where I draw the text:
var centerpoint = new Point(0,0);
dc.DrawText(ft, centerpoint);
Here is the final result:

I want the middle of the text to be in the center of the circle.
source
share