Export (0) Print
Expand All
Expand Minimize

Control.RightToLeft Property

Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.

[Visual Basic]
Public Overridable Property RightToLeft As RightToLeft
[C#]
public virtual RightToLeft RightToLeft {get; set;}
[C++]
public: __property virtual RightToLeft get_RightToLeft();
public: __property virtual void set_RightToLeft(RightToLeft);
[JScript]
public function get RightToLeft() : RightToLeft;
public function set RightToLeft(RightToLeft);

Property Value

One of the RightToLeft values. The default is Inherit.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The assigned value is not one of the RightToLeft values.

Remarks

The RightToLeft property is an ambient property. An ambient property is a control property that, if not set, is retrieved from the parent control. For example, a Button will have the same BackColor as its parent Form by default. For more information about ambient properties, see the AmbientProperties class or the Control class overview.

The RightToLeft property is used for international applications where the language is written from right to left, such as Hebrew or Arabic. When this property is set to RightToLeft.Yes, control elements that include text are displayed from right to left.

If the control is a top-level control, the user's operating system is queried to determine if the control needs to enable right-to-left support.

The following are a few examples of how control elements are affected by the RightToLeft property value of RightToLeft.Yes:

  • Vertical scroll bars are displayed on the left side rather than right side of scrollable controls (for example, Form, Panel, multiline TextBox, and RichTextBox).
  • Horizontal scroll bars start with the scroll box (thumb) right-aligned.
  • The check box element alignment, controlled by the CheckAlign property, is reversed for CheckBox and RadioButton controls.
  • Text displayed in the title bar of a Form is right-aligned. The icon and control box retain their left and right alignment respectively.
  • Items in list box, combo box, and up-down controls are right aligned.
  • Up and down buttons are left-aligned on NumericUpDown and DomainUpDown controls.
  • Menus (MainMenu, MenuItem, and ContextMenu) are displayed right-aligned.
  • The alignment of toolbar buttons on a ToolBar control or the alignment of text on a ToolBarButton is not affected by the RightToLeft property.
  • AxHost supports right-to-left alignment; however, the effect on an ActiveX control depends on the extent to which the control author implemented support for right-to-left display.
Note   When the RightToLeft property value is set to RightToLeft.Yes, the horizontal alignment of the control's elements are reversed, yet the elements' alignment values are unchanged. For example, in a TextBox control with the TextAlign property value of HorizontalAlignment.Left, text is displayed right-aligned, but the property value remains HorizontalAlignment.Left. However, if the RightToLeft property value is set to RightToLeft.Yes while the TextAlign property is set to HorizontalAlignment.Right, the text is displayed left-aligned.

Notes to Inheritors:  When overriding the RightToLeft property in a derived class, use the base class's RightToLeft property to extend the base implementation. Otherwise, you must provide all the implementation. You are not required to override both the get and set accessors of the RightToLeft property; you can override only one if needed.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | RightToLeft | HorizontalAlignment | RtlTranslateAlignment | RtlTranslateContent | RtlTranslateHorizontal | RtlTranslateLeftRight

Show:
© 2014 Microsoft