MainMenu.RightToLeft 属性

定义

获取或设置控件显示的文本是否从右向左显示。

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

RightToLeft 值之一。

例外

分配给该属性的值不是 RightToLeft 枚举的有效成员。

示例

下面的代码示例使用 GetForm 该方法来确定窗体当前是否 MainMenu 为父级。 如果示例代码GetForm中的调用不返回null,则代码会克隆使用CloneMenu该方法的MainMenu菜单结构。 然后,示例代码将 RightToLeft 属性设置为 RightToLeft.Yes 在新副本 MainMenu 上,以创建一个 MainMenu 可用于支持从右到左文本的语言。 This example requires that you have a MainMenu created that is named mainMenu1.

void CloneMyMenu()
{
   // Determine if mainMenu1 is currently hosted on the form.
   if ( mainMenu1->GetForm() != nullptr )
   {
      // Create a copy of the MainMenu that is hosted on the form.
      MainMenu^ mainMenu2 = mainMenu1->CloneMenu();

      // Set the RightToLeft property for mainMenu2.
      mainMenu2->RightToLeft = ::RightToLeft::Yes;
   }
}
public void CloneMyMenu()
{
   // Determine if mainMenu1 is currently hosted on the form.
   if(mainMenu1.GetForm() != null)
   {
      // Create a copy of the MainMenu that is hosted on the form.
      MainMenu mainMenu2 = mainMenu1.CloneMenu();
      // Set the RightToLeft property for mainMenu2.
      mainMenu2.RightToLeft = RightToLeft.Yes;
   }
}
Public Sub CloneMyMenu()
    ' Determine if mainMenu1 is currently hosted on the form.
    If (mainMenu1.GetForm() IsNot Nothing) Then
        ' Create a copy of the MainMenu that is hosted on the form.
        Dim mainMenu2 As MainMenu = mainMenu1.CloneMenu()
        ' Set the RightToLeft property for mainMenu2.
        mainMenu2.RightToLeft = RightToLeft.Yes
    End If
End Sub

注解

此属性使菜单能够支持从右到左写入的语言。 当此属性设置为 RightToLeft.Yes时,菜单项文本将从右向左显示,而不是从左到右的默认方法。

备注

有关启用从右到左对齐如何影响Windows 窗体控件的详细信息,请参阅该RightToLeft属性。

适用于

另请参阅