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相同的父系FormFor 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 :

  • 垂直捲動條會顯示在左側,而不是可滾動Form控制項的右側( Panel例如、、多行TextBoxRichTextBox)。Vertical scroll bars are displayed on the left side rather than right side of scrollable controls (for example, Form, Panel, multiline TextBox, and RichTextBox).

  • 水準捲軸會以靠右對齊的捲動方塊(thumb)開頭。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.

  • 清單方塊、下拉式方塊和上下按鈕控制項中的專案會靠右對齊。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.

  • 功能表(MainMenuMenuItemContextMenu)會靠右對齊顯示。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. 您不需要覆寫get RightToLeft屬性的和set存取子,只有在需要時,才能覆寫其中一個。You are not required to override both the get and set accessors of the RightToLeft property; you can override only one if needed.

適用於

另請參閱