I am doing some custom drawing using DrawingContext in WPF. I am using DrawingContext.DrawText
for drawing strings. Now, at a place I want to draw the text vertically. Is there any option in the DrawingContext OR DrawText() function to draw text vertically?
Here is my solution: It is need to create rotate transform around the text origin, so we pass x and y to RotateTransform constructor
...
// ft - formatted text, (x, y) - point, where to draw
dc.PushTransform(new RotateTransform(-90, x, y));
dc.DrawText(ft, new Point(x, y));
dc.Pop();
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With