다음을 통해 공유


MenuDesigner.Initialize(IComponent) 메서드

정의

연결된 컨트롤을 표시, 편집 및 디자인할 디자이너를 준비합니다.

public:
 override void Initialize(System::ComponentModel::IComponent ^ component);
public override void Initialize (System.ComponentModel.IComponent component);
override this.Initialize : System.ComponentModel.IComponent -> unit
Public Overrides Sub Initialize (component As IComponent)

매개 변수

component
IComponent

Menu 인터페이스를 구현하는 IComponent입니다.

예외

componentMenu가 아니거나 Menu에서 파생된 클래스가 아닙니다.

예제

다음 코드 예제에서는 재정의 하는 방법을 보여 줍니다.는 Initialize 에서 상속 된 클래스에서 메서드를 MenuDesigner 클래스입니다. 파생 된 컨트롤의 동작을 변경 하는 재정의 된 메서드는 Menu 디자인 타임에는 클래스입니다. 이 예제에서는 throw를 ArgumentException 연결된 된 컨트롤이 없는 경우 예외를 MyMenu 개체.

public override void Initialize(IComponent component)
{
    // Ensure that only a MyMenu can be created in this designer.
    if (!(component is MyMenu))
        throw new ArgumentException(
            "The component is not a MyMenu control.");
    
    base.Initialize(component);
} // Initialize
Public Overrides Sub Initialize(ByVal component As IComponent)

    ' Ensure that only a MyMenu can be created in this designer. 
    If Not TypeOf component Is MyMenu Then
        Throw New ArgumentException( _
            "The component is not a MyMenu control.")
    End If

    MyBase.Initialize(component)

End Sub

설명

비주얼 디자이너 호출을 Initialize 메서드를 렌더링 하는 디자이너를 사용할 준비가 되었을 때를 Menu 컨트롤입니다. Initialize 메서드 및 해당 기본 메서드 속성을 구성 하 고 디자이너의 작업에 필요한 이벤트를 설정 합니다.

합니다 component 매개 변수는는 Menu 이 디자이너 또는 해당 컨트롤의 복사본을 사용 하 여 연결 된 컨트롤입니다.

적용 대상

추가 정보