Edit

Share via


Control.RightToLeft Property

Definition

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

public:
 virtual property System::Windows::Forms::RightToLeft RightToLeft { System::Windows::Forms::RightToLeft get(); void set(System::Windows::Forms::RightToLeft value); };
public virtual System.Windows.Forms.RightToLeft RightToLeft { get; set; }
member this.RightToLeft : System.Windows.Forms.RightToLeft with get, set
Public Overridable Property RightToLeft As RightToLeft

Property Value

One of the RightToLeft values. The default is Inherit.

Exceptions

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.

Note

If the value of the RightToLeft property is changed at run time, only raw text without formatting is preserved.

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.

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

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.

Applies to

See also