MainMenu.GetForm 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 컨트롤을 Form 포함하는 항목을 가져옵니다.
public:
System::Windows::Forms::Form ^ GetForm();
public System.Windows.Forms.Form GetForm();
member this.GetForm : unit -> System.Windows.Forms.Form
Public Function GetForm () As Form
반환
이 컨트롤의 컨테이너인 A Form 입니다.
null 폼에서 MainMenu 현재 호스트되지 않은 경우 반환합니다.
예제
다음 코드 예제에서는 메서드를 GetForm 사용 하 여 현재 폼에 MainMenu 부모 인지 확인 합니다. 예제 코드 GetForm 의 호출이 반환null되지 않으면 코드는 using CloneMenu 메서드의 MainMenu 메뉴 구조를 복제합니다. 그런 다음 코드는 오른쪽에서 왼쪽 텍스트를 지원하는 언어에 사용할 수 있는 속성을 만드는 MainMenu 새 복사본 MainMenu 에서 true로 설정합니다RightToLeft. 이 예제에서는 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
설명
이 속성을 사용 하면 특정 MainMenu 폼에 부모인지 여부를 확인할 수 있습니다. 이 속성은 일반적으로 폼에서 여러 MainMenu 개체를 사용 중이며 현재 폼에서 사용 중인 개체를 결정해야 하는 경우에 사용됩니다.