How to send text to a printer from right to left in C #

I want to print some data in a form using code:

e.Graphics.DrawString(string.Format("السيد {0}", lstCustomers.Text), regularFont, Brushes.Black, 30, y);

but there is one Arabic text next to English. And here, if the layout is not set as RightToLeft, the text does not display correctly.

The problem is that when I print, I don’t see the required property!

+5
source share
1 answer

Use StringFormatand specify the format flag DirectionRightToLeft, So:

using (StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft))
{
    e.Graphics.DrawString(string.Format("السيد {0}"), font, brush, location, format);
}
+6
source

All Articles