Share via


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 為表單上層。 如果範例程式碼中的 呼叫未傳回 null ,則程式碼 GetForm 接著會使用 CloneMenu 方法複製 的 MainMenu 功能表結構。 然後範例程式碼會將 RightToLeft 的新複本 MainMenu 上的 屬性 RightToLeft.Yes 設定為 ,以建立 MainMenu 可用於支援由右至左文字的語言。 此範例會要求您已 MainMenu 建立名為 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 Forms控制項的詳細資訊,請參閱 RightToLeft 屬性。

適用於

另請參閱