MenuDesigner.Initialize(IComponent) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
연결된 컨트롤을 보고 편집하고 디자인할 디자이너를 준비합니다.
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
인터페이스를 구현하는 A Menu입니다 IComponent .
예외
예제
다음 코드 예제에서는 클래스에서 상속 되는 클래스에서 메서드를 재정 Initialize 의 하는 방법을 보여 집니다 MenuDesigner . 재정의된 메서드는 디자인 타임에 클래스에서 파생된 컨트롤의 동작을 Menu 변경합니다. 이 예제에서는 연결된 컨트롤이 ArgumentException 개체가 아닌 경우 예외를 MyMenu throw합니다.
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 이 디자이너 또는 해당 컨트롤의 복사본과 연결된 컨트롤입니다.