Hi friends,
Recently I came across a situation where I had to display string in right to left flowdirection.
And at this point I realize that it was coming as mirror image 
Here is the method to solve this problem:
private void TransFormAndDrawText(FormattedText fTxt ,double dStartPoint, double dEndPoint, DrawingContext g)
{
MatrixTransform antiMirror = null;
if (FlowDirection == FlowDirection.RightToLeft)
{
double offsetX = fTxt.Width;
double offsetY = 0;
antiMirror = new MatrixTransform(-1, 0, 0, 1, offsetX, offsetY);
dStartPoint *= -1;
}
if (antiMirror != null)
{
g.PushTransform(antiMirror);
}
g.DrawText(fTxt, new Point(dStartPoint, dEndPoint));
if (antiMirror != null)
{
g.Pop();
}
}
1 comment:
Very useful info.
Thanks
Post a Comment