영어로 읽기

다음을 통해 공유


PropertyValueUIItemInvokeHandler 대리자

정의

InvokeHandlerPropertyValueUIItem 이벤트를 처리할 메서드를 나타냅니다.

public delegate void PropertyValueUIItemInvokeHandler(ITypeDescriptorContext context, PropertyDescriptor descriptor, PropertyValueUIItem invokedItem);

매개 변수

context
ITypeDescriptorContext

두 번 클릭한 아이콘과 연결된 속성의 ITypeDescriptorContext입니다.

descriptor
PropertyDescriptor

두 번 클릭한 아이콘과 연결된 속성입니다.

invokedItem
PropertyValueUIItem

두 번 클릭한 아이콘과 연결된 PropertyValueUIItem입니다.

예제

다음 코드 예제에서는 또는 VerticalMargin라는 HorizontalMargin 구성 요소의 속성에 대 한 개체를 제공 PropertyValueUIItem 합니다. 이러한 속성의 은 PropertyValueUIItem 속성의 이미지를 클릭할 때 메시지 상자를 표시하는 이미지, 도구 설명 및 이벤트 처리기를 제공합니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 IPropertyValueUIService 인터페이스입니다.

// PropertyValueUIHandler delegate that provides PropertyValueUIItem
// objects to any properties named HorizontalMargin or VerticalMargin.
private void marginPropertyValueUIHandler(
    System.ComponentModel.ITypeDescriptorContext context,
    System.ComponentModel.PropertyDescriptor propDesc,
    ArrayList itemList)
{
    // A PropertyValueUIHandler added to the IPropertyValueUIService
    // is queried once for each property of a component and passed
    // a PropertyDescriptor that represents the characteristics of 
    // the property when the Properties window is set to a new 
    // component. A PropertyValueUIHandler can determine whether 
    // to add a PropertyValueUIItem for the object to its ValueUIItem 
    // list depending on the values of the PropertyDescriptor.
    if (propDesc.DisplayName.Equals("HorizontalMargin"))
    {
        Image img = Image.FromFile("SampImag.jpg");
        itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
    }
    if (propDesc.DisplayName.Equals("VerticalMargin"))
    {
        Image img = Image.FromFile("SampImag.jpg");
        img.RotateFlip(RotateFlipType.Rotate90FlipNone);
        itemList.Add(new PropertyValueUIItem(img, new PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test ToolTip"));
    }
}

설명

속성 창 아이콘을 두 번 클릭하면 아이콘이 연결된 의 PropertyValueUIItem 이벤트가 발생 InvokeHandler 합니다. InvokeHandler 이벤트는 일반적으로 UI(사용자 인터페이스)를 실행하여 속성의 값을 편집합니다. PropertyValueUIItemInvokeHandler InvokeHandler 속성 이름 옆에 표시된 아이콘을 PropertyValueUIItem 두 번 클릭할 때 적절한 동작을 수행할 이벤트 처리기를 할당하려면 의 속성에 을 추가합니다.

PropertyValueUIItemInvokeHandler 대리자를 만들 때, 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 이벤트 처리기 대리자에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

추가 정보