Click here to Skip to main content
13,146,498 members (49,502 online)
Click here to Skip to main content
Add your own
alternative version

Stats

122.3K views
5.6K downloads
39 bookmarked
Posted 26 Sep 2003

Windows Forms and Controls with Right to Left Layout

, 14 Nov 2003
Rate this:
Please Sign up or sign in to vote.
You can get right to left Forms and Controls with mirroring property, which Right to Left Common property can't do.

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.

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 affected by this propertyNo
PrintPreviewDialogText displayed in a Form's title bar is right-alignedNo
ProgressBarNot affected 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

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 Windows 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. 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.

But there is a non-like thing. When you design a Form and put some some controls on it, the appearance during runtime will be mirrored. The control that you put it at the right of the form will be shown at the left.

History

  • 14 Nov 2003 - udpated downloads

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

A.Said
Turkey Turkey
BS(Electronics Engineer)

You may also be interested in...

Pro

Comments and Discussions

 
GeneralMy vote of 1 Pin
Mohammad Rastkar28-Jul-10 1:12
memberMohammad Rastkar28-Jul-10 1:12 
GeneralMy vote of 1 Pin
Michael Coyle30-Mar-10 8:42
memberMichael Coyle30-Mar-10 8:42 
GeneralRe: My vote of 1 Pin
oeatek8-Sep-10 4:36
memberoeatek8-Sep-10 4:36 
GeneralMy vote of 1 Pin
Mohammad Rastkar17-Mar-10 6:33
memberMohammad Rastkar17-Mar-10 6:33 
GeneralForm Caption Mirrored when it shouldn't be Pin
JohnGalt1722-Sep-08 3:49
memberJohnGalt1722-Sep-08 3:49 
GeneralHello Pin
Harold Dunn16-Sep-08 4:33
memberHarold Dunn16-Sep-08 4:33 
GeneralEbrahim Nasr Pin
ebrahimbaba30-Mar-07 3:11
memberebrahimbaba30-Mar-07 3:11 
QuestionToolbar RTL Pin
nighelfs18-Sep-06 4:55
membernighelfs18-Sep-06 4:55 
Generalrighttoleft in listbox doesnt work!!!! [modified] Pin
nafiseh_salmani13-Aug-06 20:14
membernafiseh_salmani13-Aug-06 20:14 
GeneralHelp for RTL Tab Pages Pin
salianrakesh24-Feb-06 20:41
membersalianrakesh24-Feb-06 20:41 
GeneralRe: Help for RTL Tab Pages Pin
eliyahubh11-Sep-13 11:19
membereliyahubh11-Sep-13 11:19 
Generalgarbage during mouseover in right to left layout Pin
audille8-Apr-05 22:18
memberaudille8-Apr-05 22:18 
GeneralRe: garbage during mouseover in right to left layout Pin
Averk11-Dec-05 0:04
memberAverk11-Dec-05 0:04 
GeneralMirror Progressbar in RTL Pin
deepapai28-Mar-05 17:37
sussdeepapai28-Mar-05 17:37 
GeneralMain Menu Pin
Peer Adi15-Nov-04 21:46
memberPeer Adi15-Nov-04 21:46 
GeneralRe: Main Menu Pin
mshoukry_alkhwarazmi29-Oct-05 22:43
membermshoukry_alkhwarazmi29-Oct-05 22:43 
GeneralTree View Pin
Fakher Halim10-Aug-04 13:56
memberFakher Halim10-Aug-04 13:56 
GeneralRTL is not perfect ... Pin
morali2k22-May-04 1:44
sussmorali2k22-May-04 1:44 
GeneralListView RTL Pin
fabis10-Mar-04 0:57
memberfabis10-Mar-04 0:57 
GeneralRe: ListView RTL Pin
Anonymous20-Mar-04 5:51
sussAnonymous20-Mar-04 5:51 
GeneralMissing Files! Pin
tim_mcgwyn27-Sep-03 6:27
membertim_mcgwyn27-Sep-03 6:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170915.1 | Last Updated 15 Nov 2003
Article Copyright 2003 by A.Said
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid