Condividi tramite


MainMenu.RightToLeft Proprietà

Definizione

Ottiene o imposta un valore che indica se il testo visualizzato dal controllo viene visualizzato da destra a sinistra.

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

Valore della proprietà

Uno dei RightToLeft valori.

Eccezioni

Il valore assegnato alla proprietà non è un membro valido dell'enumerazione RightToLeft .

Esempio

Nell'esempio di codice seguente viene utilizzato il GetForm metodo per determinare se un oggetto MainMenu è attualmente padre del form. Se la chiamata nel codice di esempio a non restituisce nullGetForm , il codice clona la struttura di menu dell'oggetto MainMenu utilizzando il CloneMenu metodo . Il codice di esempio imposta quindi la RightToLeft proprietà su RightToLeft.Yes nella nuova copia di MainMenu per creare un MainMenu oggetto che può essere utilizzato per le lingue che supportano il testo da destra a sinistra. Questo esempio richiede che sia stato creato un MainMenu oggetto denominato 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

Commenti

Questa proprietà consente ai menu di supportare le lingue scritte da destra a sinistra. Quando questa proprietà è impostata su RightToLeft.Yes, il testo della voce di menu verrà visualizzato da destra a sinistra anziché dal metodo predefinito da sinistra a destra.

Annotazioni

Per altre informazioni sull'abilitazione dell'allineamento da destra a sinistra sui controlli Windows Form, vedere la RightToLeft proprietà .

Si applica a

Vedi anche