How can i flip a string in c#
application like for example : "AMBULANCE" text that is seen as mirror image.I dont have any idea to where to start with .im using c#
forms application
I have tried for reversing the string ,but is there any possibility to flip a string (like mirror images)?
Like : ƎƆИA⅃UᙠMA
This is not reversing as in SO post
As well as the approach outlined by Sergey, you can also use Graphics.ScaleTransform()
to reflect everything about the Y-axis.
For example, create a default Windows Forms application and drop the following OnPaint()
into it, then run it:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
string text = "This will come out backwards";
e.Graphics.ScaleTransform(-1, 1);
float w = e.Graphics.MeasureString(text, this.Font).Width;
e.Graphics.DrawString(text, this.Font, Brushes.Black, -w, 0);
}
Output:
You can also mess around with Graphics.RotateTransform()
to rotate the text as well, and use Graphics.ScaleTransform(1, -1)
to invert it as well as mirror it:
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