Reputation: 574
Is there a way in C# where we can print Right-to-left languages like Arabic so that output is right-to-left, not just right aligned.
This HTML like snippet might be helpful in explaining the requirement:
<div style="direction:rtl;">كمشنيش (شسي شسي)</div> <!-- correct -->
<div style="text-align:right;">كمشنيش (شسي شسي)</div> <!-- just right aligned -->
I want my application to look like the first div.
Upvotes: 0
Views: 1662
Reputation: 1129
There are many ways and contexts that you would print right to left. In a web application you could address this in the html tag.
In WinForms @keyboardP suggested the RightToLeft property set to Yes.
In WPF FlowDirection can be used, however this should be done at the early stages of your view design as it can cause unexpected results in views designed for left to right readout.
Upvotes: 1
Reputation: 69372
If you're using WinForms
, set the form's RightToLeft property to RightToLeft.Yes
. Any control on the form will automatically inherit that property by default. If you only want certain controls to have that property then you can set that individually for each control.
If you're using Silverlight 4, you can set the FlowDirection property.
<TextBox FlowDirection="RightToLeft" ... />
There's more information about Right to Left text in Silverlight here.
Upvotes: 4
Reputation: 3538
It should be sufficient to add the dir="rtl"
attribute to your <html>
open tag.
Check out the following article: Creating HTML Pages in Arabic, Hebrew and Other Right-to-left Scripts
Upvotes: 0