MainMenu.RightToLeft 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定控制項顯示的文字是從右到左。
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 。
範例
以下程式碼範例使用該 GetForm 方法來判斷 a MainMenu 目前是否被子層管理為表單。 如果範例程式碼GetForm中的呼叫未回傳 null,程式碼就會複製使用 該MainMenuCloneMenu方法的選單結構。 範例程式碼接著在新的 版本MainMenu上設定RightToLeft屬性為 ,RightToLeft.Yes以建立MainMenu可用於支援從右到左文字的語言的 a。 這個範例要求你有一個 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 表單控制項的資訊,請參閱相關屬性。RightToLeft