Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send text to printer with right to left direction in C#

Tags:

c#

.net

printing

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

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

but there are some Arabic text beside English once. And here, If the layout is not set as RightToLeft, the text not appear correctly.

The problem is: In printing, I don't see the property needed!

like image 991
Hashem AL-Rifai Avatar asked Aug 04 '11 13:08

Hashem AL-Rifai


1 Answers

Use StringFormat and specify format flag to DirectionRightToLeft, So:

using (StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft))
{
    e.Graphics.DrawString(string.Format("السيد {0}"), font, brush, location, format);
}
like image 87
Jalal Said Avatar answered Nov 15 '22 04:11

Jalal Said