|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Create Mirrored Windows Forms and Controls
Some language scripts, such as Arabic and Hebrew, are traditionally written and read from right to left, instead of from left to right. Users of right-to-left language scripts not only expect text in their software applications to flow from right to left, they also expect that all of the controls on a form flow from right to left. When you place text and controls on a form in right-to-left order it is called mirroring, because you are creating a mirror image of the more common left-to-right order.
Theproperty on forms and controls determines the reading order of these objects, while the property controls how forms and some container controls render their contained controls. RightToLeftLayout is not defined on every control, however; , , and are a few controls that lack an implementation. For these controls, you must use one of the panel layout controls, such as or , to achieve true right-to-left rendering of a control's contained controls.
The following procedure demonstrates how to mirror your form to render from right to left, and how to compensate for some of the limitations of RightToLeftLayout support.
For more information about arranging text in right-to-left order, see
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see.
To create a mirrored Windows Form or control
Create a new Windows Forms project in Visual Studio. For more information, see.
In the Property Editor for Form1, setto Yes and RightToLeftLayout to True.
Drag a TabControl from the Toolbox and onto the form.
In the Property Editor for TabControl1, set theproperty to Full, which is the center square in the property's UI editor.
Set the RightToLeftLayout property of the TabControl to True.
Drag a FlowLayoutPanel control from the Toolbox onto tabPage1. The control will base its default layout order on the RightToLeft property of tabPage1, meaning in this case that it will default to Yes.
Add a, and control to the FlowLayoutPanel.
Run the project. You should see the entire form—including the title bar, control boxes, and all contained controls—render from right to left.