Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Windows Forms
 How to: Display Right-to-Left Text ...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Windows Forms Programming
How to: Display Right-to-Left Text in Windows Forms for Globalization

Certain scripts, such as Arabic, are written from right to left. To control the flow of text in a control such as a TextBox, you use the RightToLeft property. An additional step is needed, however, to mirror the control itself on the form: You must set the RightToLeftLayout property, which controls the appearance of controls within a container.

You do not need to change the values of properties such as the TextAlign value of a TextBox control: the value stays the same but the alignment is reversed.

To display right-to-left text

  1. Set the form's RightToLeft property to Yes.

  2. Set the form's RightToLeftLayout property to true.

  3. Place a TextBox control on the form, either programmatically or using a development environment such as Visual Studio. It will inherit the right-to-left setting of the form, since the default value for the RightToLeft property is Inherit. (If you wish to override the setting for another control on the form, set that control's RightToLeft property to No.)

  4. Compile and run your application. You will notice that the form's controls and title are mirrored to run from right to left. Enter text inside of the TextBox. You will notice that it enters from right to left.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker