I'm using DrawText
to draw FormattedText
on Visual Layer. Now I'm using the code below to define the formatted text and I'm able to set the TextAlignment
to Center
. But what about the VerticalAlignment
? As you can see in the image below the center of the text is not on the centerpoint which is shown with a red dot here.
The part where I'm defining the 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'm drawing the text:
var centerpoint = new Point(0,0);
dc.DrawText(ft, centerpoint);
Here is final result:
I want the middle of the text to lie on the center of the circle.