Export (0) Print
Expand All

Bi-directional Support for Windows Applications

You can use Visual Studio to create Windows applications that support bi-directional languages such as Arabic and Hebrew. This includes standard forms, dialog boxes, MDI forms, and all the controls you can work with in these forms — that is, all the objects in the System.Windows.Forms.Control namespace.

Culture Support

Culture and UI culture settings determine how an application works with dates, times, currency, and other information. Support for culture and UI culture is the same for bi-directional languages as it is for any other languages. For details, see Culture-Specific Classes for Global Windows Forms and Web Forms.

RightToLeft Property

The base Control class (from which forms derive) includes a RightToLeft property that you can set to change the reading order of a form and its controls. If you set the form's RightToLeft property, by default controls on the form inherit this setting. However, you can also set the RightToLeft property individually on most controls. For details, see Displaying Right-to-Left Text in Windows Forms for Globalization.

The effect of the RightToLeft property can differ from one control to another. In some controls it only sets the reading order, as in the Button, TreeView and ToolTip controls. In other controls, the RightToLeft property changes both reading order and layout. This includes the RadioButton, ComboBox and CheckBox controls. The following table provides details on how the RightToLeft property affects individual Windows Forms controls.

Control/ComponentEffect of RightToLeft propertyRequires mirroring?
ButtonSets the RTL reading orderNo
CheckBoxThe check box is displayed on the right side of the textNo
CheckedListBoxAll the check boxes are displayed on the right side of the textNo
ColorDialogNot affected; depends on the language of the operating systemNo
ComboBoxItems in combo box control are right-alignedNo
ContextMenuAppears right-aligned with RTL reading orderNo
DataGridAppears right-aligned with RTL reading orderNo
DateTimePickerNot affected; depends on the language of the operating systemNo
DomainUpDownLeft-aligns the up and down buttonsNo
ErrorProviderNot supportedNo
FontDialogDepends on the language of the operating systemNo
GroupBoxThe caption is displayed right aligned. Child controls may inherit this property.No
HScrollBarStarts with the scroll box (thumb) right-alignedNo
ImageListNot requiredNo
LabelDisplayed right-alignedNo
LinkLabelDisplayed right-alignedNo
ListBoxItems are right-alignedNo
ListViewSets the reading order to RTL; elements stay left-alignedYes
MainMenuDisplayed right-aligned with RTL reading order at run time (not at design time)No
MonthCalendarNot affected; depends on the language of the operating systemNo
NotifyIconNot supportedNo
NumericUpDownUp and down buttons are left-alignedNo
OpenFileDialogNot affected; depends on the language of the operating systemNo
PageSetupDialogNot affected; depends on the language of the operating systemNo
PanelChild controls may inherit this propertyYes
PictureBoxNot supportedNo
PrintDialogNot affected; depends on the language of the operating systemNo
PrintDocumentThe vertical scroll bar become left-aligned and the horizontal scroll bar starts from the leftNo
PrintPreviewNot affect by this propertyNo
PrintPreviewDialogText displayed in a form's title bar is right-alignedNo
ProgressBarNot affect by this propertyYes
RadioButtonThe radio button is displayed on the right side of the textNo
RichTextBoxControl elements that include text are displayed from right to left with RTL reading orderNo
SaveFileDialogNot affected; depends on the language of the operating systemNo
SplitterNot supportedNo
StatusBarThe text in the panels is right-aligned with RTL reading orderYes
TabControlNot affected by this propertyYes
TextBoxDisplays text from right to left with RTL reading orderNo
TimerNot requiredNo
ToolBarNot affected by this propertyYes
ToolTipSets the RTL reading orderNo
TrackBarThe scroll or track starts from the rightNo
TreeViewSets the RTL reading order onlyYes
VScrollBarDisplayed on the left side rather than right side of scrollable controlsNo

Encoding

Windows Forms support Unicode, so you can include any character set when creating them. However, not all Windows Forms controls support Unicode on all platforms. For details, see Encoding and Windows Forms Globalization.

GDI+

You can use GDI+ to draw text with right-to-left reading order. The DrawString method, which is used to draw text, supports a StringFormat parameter that you can set to the DirectionRightToLeft member of the StringFormatFlags enumeration in order to reverse the point of origin for the text.

Common Dialog Boxes

System tools such as the File Open dialog box are under the control of Windows. They inherit language elements from the operating system. If you are using a version of Windows with the correct language settings, these dialog boxes will work properly with bi-directional languages.

Similarly, message boxes go through the operating system and support bi-directional text. The captions on message box buttons are based on the current language setting. By default, message boxes do not use right-to-left reading order, but you can specify a parameter to change this when displaying the message box. For details, see Creating Message Boxes for Bi-Directional Windows Applications.

Mirroring

Mirroring refers to reversing the layout of UI elements so that they flow from right to left. In a mirrored Windows Form, for example, the Minimize, Maximize, and Close buttons appear left-most on the title bar, not right-most.

Setting a form or control's RightToLeft property to true reverses the reading order of elements on a form, but it does not reverse the layout to be right-to-left — that is, it does not cause mirroring. For example, it does not move the Minimize, Maximize, and Close buttons in the form's title bar to the left side of the form. Similarly, some controls, such as the TreeView control, require mirroring in order to change their display to be appropriate for Arabic or Hebrew.

You cannot directly mirror a form or control. However, you can create mirroring in code. For forms, you can set an extended Window style to cause mirroring. For most controls that require mirroring, you can create a mirrored control by inheriting from the base control and setting the same Windows extended style. For details, see Creating Mirrored Windows Forms and Controls.

You can create mirrored versions of the following controls.

ListViewPanelStatusBar
TabControlTabPageToolBar
Treeview  

Some controls are sealed, so you cannot derive a new control from them. These include the ImageList and ProgressBar controls.

See Also

Creating Mirrored Windows Forms and Controls | Creating Message Boxes for Bi-Directional Windows Applications | Bi-directional Support for Web Applications | Globalizing Windows Forms | Localizing Applications | Visual Studio .NET With Arabic Language Support (this link goes to the Microsoft.com Web site)

Show:
© 2014 Microsoft