Control.RightToLeft Control.RightToLeft Control.RightToLeft Control.RightToLeft Property

定义

获取或设置一个值,该值指示是否将控件的元素对齐以支持使用从右向左的字体的区域设置。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

属性值

RightToLeft 值之一。One of the RightToLeft values. 默认值为 InheritThe default is Inherit.

异常

注解

RightToLeft属性是一个环境属性。The RightToLeft property is an ambient property. 环境属性是控件属性,如果未设置,检索从父控件。An ambient property is a control property that, if not set, is retrieved from the parent control. 例如,Button具有相同BackColor作为其父Form默认情况下。For example, a Button will have the same BackColor as its parent Form by default. 有关环境属性的详细信息,请参阅AmbientProperties类或Control类概述。For more information about ambient properties, see the AmbientProperties class or the Control class overview.

RightToLeft属性用于国际应用程序语言从右到左,例如希伯来语或阿拉伯语的写入位置。The RightToLeft property is used for international applications where the language is written from right to left, such as Hebrew or Arabic. 当此属性设置为RightToLeft.Yes,从右到左显示包含文本的控件元素。When this property is set to RightToLeft.Yes, control elements that include text are displayed from right to left.

备注

如果的值RightToLeft在运行时更改属性,仅对不带格式的原始文本时保留。If the value of the RightToLeft property is changed at run time, only raw text without formatting is preserved.

以下是几个示例的控件元素如何受RightToLeft属性值为RightToLeft.Yes:The following are a few examples of how control elements are affected by the RightToLeft property value of RightToLeft.Yes :

  • 在左侧而不是可滚动控件的右侧显示垂直滚动条 (例如, FormPanel多行TextBox,和RichTextBox)。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.

  • 复选框元素对齐方式,受CheckAlign属性,已逆转CheckBoxRadioButton控件。The check box element alignment, controlled by the CheckAlign property, is reversed for CheckBox and RadioButton controls.

  • 右对齐列表框、 组合框和 up-down 控件中的项。Items in list box, combo box, and up-down controls are right aligned.

  • 向上和向下按钮为上的左对齐NumericUpDownDomainUpDown控件。Up and down buttons are left-aligned on NumericUpDown and DomainUpDown controls.

  • 菜单 (MainMenuMenuItem,和ContextMenu) 右对齐显示。Menus (MainMenu, MenuItem, and ContextMenu) are displayed right-aligned.

  • 上的工具栏按钮的对齐ToolBar控件或上文本的对齐方式ToolBarButton不会影响RightToLeft属性。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 支持从右到左对齐方式;但是,ActiveX 控件上的效果取决于向其控件作者实现对从右到左显示支持的范围。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.

继承者说明

重写时RightToLeft属性在派生类中,使用基类的RightToLeft属性扩展的基实现。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. 不需要重写二者getset访问器RightToLeft属性; 您可以根据需要覆盖只有一个。You are not required to override both the get and set accessors of the RightToLeft property; you can override only one if needed.

适用于

另请参阅