IPropertyValueUIServiceとは? わかりやすく解説

IPropertyValueUIService イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント PropertyUIValueItemsChanged PropertyValueUIItem オブジェクトリスト変更されたときに発生します
参照参照

関連項目

IPropertyValueUIService インターフェイス
System.Drawing.Design 名前空間
PropertyValueUIHandler
PropertyValueUIItem

IPropertyValueUIService インターフェイス

プロパティ ブラウザ表示されるコンポーネントプロパティイメージツール ヒント、およびイベント ハンドラ管理するユーザー インターフェイス提供します

名前空間: System.Drawing.Design
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Interface IPropertyValueUIService
Dim instance As IPropertyValueUIService
public interface IPropertyValueUIService
public interface class IPropertyValueUIService
public interface IPropertyValueUIService
public interface IPropertyValueUIService
解説解説

コンポーネントでは、IPropertyValueUIService インターフェイス使用することで、コンポーネントすべてのプロパティに対して PropertyValueUIItem オブジェクトを提供できますプロパティ関連付けられた PropertyValueUIItem では、イメージツール ヒントの他に、プロパティ関連付けられたイメージクリックされたときに発生するイベントイベント ハンドラを提供できます

IPropertyValueUIService インターフェイスは、内部リストに対して PropertyValueUIHandler デリゲート追加削除、および検索を行うメソッド提供しますコンポーネントプロパティプロパティ ブラウザ表示されるときに、リスト中の各 PropertyValueUIHandler は、PropertyValueUIItemコンポーネントの各プロパティに提供できます

プロパティ ブラウザは、オブジェクトプロパティ表示するように設定されると、コンポーネントの各プロパティごとに、プロパティを表す PropertyDescriptor を渡して、このインターフェイスの GetPropertyUIValueItems メソッド呼び出します。GetPropertyUIValueItems メソッドは、サービス追加されている各 PropertyValueUIHandler呼び出します。PropertyValueUIHandler は、valueUIItemList パラメータ渡される PropertyValueUIItem を ArrayList パラメータ追加することによって、propDesc パラメータ渡される PropertyDescriptor が表すプロパティに対してそれらの UI 項目を提供します

PropertyValueUIItem には、プロパティ名の横に表示するイメージツール ヒント文字列、およびプロパティ関連付けられたイメージダブルクリックされたときに呼び出されるイベント ハンドラ格納できます

使用例使用例

次のコード例では、IPropertyValueUIService インターフェイスインスタンス取得するコンポーネント作成します。このコンポーネントは、取得したサービスPropertyValueUIHandler追加します追加されたこのハンドラは、コンポーネント含まれているプロパティのうち、 HorizontalMargin または VerticalMargin という名前のすべてのプロパティに対してPropertyValueUIItem オブジェクト提供します。なお、この PropertyValueUIItem は、対象プロパティイメージツールヒント提供するだけでなく、それらのプロパティイメージクリックされたときにメッセージ ボックス表示するイベント ハンドラ提供しますイメージツールヒントは、これらのプロパティが PropertyGrid に表示されているときに表示されます。

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Drawing.Design
Imports System.IO
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

' This component obtains the IPropertyValueUIService and adds a
' PropertyValueUIHandler that provides PropertyValueUIItem objects
' which provide an image, tooltip and invoke event handler to
' any properties named HorizontalMargin and VerticalMargin, 
' such as the example integer properties on this component.    
Public Class PropertyUIComponent
    Inherits System.ComponentModel.Component

    ' Example property for which to provide PropertyValueUIItem.
    Public Property HorizontalMargin() As
 Integer
        Get
            Return hMargin
        End Get
        Set(ByVal Value As
 Integer)
            hMargin = Value
        End Set
    End Property

    ' Example property for which to provide PropertyValueUIItem.   
    
    Public Property VerticalMargin() As
 Integer
        Get
            Return vMargin
        End Get
        Set(ByVal Value As
 Integer)
            vMargin = Value
        End Set
    End Property

    ' Field storing the value of the HorizontalMargin property
    Private hMargin As Integer

    ' Field storing the value of the VerticalMargin property
    Private vMargin As Integer

    ' Base64-encoded serialized image data for image icon.
    Private imageBlob1 As String
 = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////////////////////////////////8L"

    ' Constructor.
    Public Sub New(ByVal
 container As System.ComponentModel.IContainer)
        If Not (container Is
 Nothing) Then
            container.Add(Me)
        End If
        hMargin = 0
        vMargin = 0
    End Sub

    ' Default component constructor that specifies no container.
    Public Sub New()
        MyClass.New(Nothing)
    End Sub

    ' PropertyValueUIHandler delegate that provides PropertyValueUIItem
    ' objects to any properties named HorizontalMargin or VerticalMargin.
    Private Sub marginPropertyValueUIHandler(ByVal
 context As System.ComponentModel.ITypeDescriptorContext, ByVal
 propDesc As System.ComponentModel.PropertyDescriptor, ByVal itemList As ArrayList)
        ' 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")
 Then
            Dim img As Image = DeserializeFromBase64Text(imageBlob1)
            itemList.Add(New PropertyValueUIItem(img, New
 PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke),
 "Test ToolTip"))
        End If
        If propDesc.DisplayName.Equals("VerticalMargin")
 Then
            Dim img As Image = DeserializeFromBase64Text(imageBlob1)
            img.RotateFlip(RotateFlipType.Rotate90FlipNone)
            itemList.Add(New PropertyValueUIItem(img, New
 PropertyValueUIItemInvokeHandler(AddressOf Me.marginInvoke),
 "Test ToolTip"))
        End If
    End Sub

    ' Invoke handler associated with the PropertyValueUIItem objects
 
    ' provided by the marginPropertyValueUIHandler.
    Private Sub marginInvoke(ByVal
 context As System.ComponentModel.ITypeDescriptorContext, ByVal
 propDesc As System.ComponentModel.PropertyDescriptor, ByVal item As PropertyValueUIItem)
        MessageBox.Show("Test invoke message box")
    End Sub

    ' Component.Site override to add the marginPropertyValueUIHandler
    ' when the component is sited, and to remove it when the site is
 
    ' set to null.
    Public Overrides Property
 Site() As System.ComponentModel.ISite
        Get
            Return MyBase.Site
        End Get
        Set(ByVal Value As
 System.ComponentModel.ISite)
            If Not (Value Is
 Nothing) Then
                MyBase.Site = Value
                Dim uiService As IPropertyValueUIService
 = CType(Me.GetService(GetType(IPropertyValueUIService)),
 IPropertyValueUIService)
                If Not (uiService Is
 Nothing) Then
                    uiService.AddPropertyValueUIHandler(New PropertyValueUIHandler(AddressOf
 Me.marginPropertyValueUIHandler))
                End If
            Else
                Dim uiService As IPropertyValueUIService
 = CType(Me.GetService(GetType(IPropertyValueUIService)),
 IPropertyValueUIService)
                If Not (uiService Is
 Nothing) Then
                    uiService.RemovePropertyValueUIHandler(New
 PropertyValueUIHandler(AddressOf Me.marginPropertyValueUIHandler))
                End If
                MyBase.Site = Value
            End If
        End Set
    End Property

    ' This method can be used to retrieve an Image from a block 
    ' of Base64-encoded text.
    Private Function DeserializeFromBase64Text(ByVal
 [text] As String) As Image
        Dim img As Image = Nothing
        Dim memBytes As Byte()
 = Convert.FromBase64String([text])
        Dim formatter As New
 BinaryFormatter()
        Dim stream As New
 MemoryStream(memBytes)
        img = CType(formatter.Deserialize(stream), Image)
        stream.Close()
        Return img
    End Function

End Class
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Design;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace PropertyValueUIServiceExample
{
    // This component obtains the IPropertyValueUIService and adds a
    // PropertyValueUIHandler that provides PropertyValueUIItem objects
    // which provide an image, ToolTip, and invoke event handler to
    // any properties named HorizontalMargin and VerticalMargin, 
    // such as the example integer properties on this component.   
 
    public class PropertyUIComponent : System.ComponentModel.Component
    {
        // Example property for which to provide a PropertyValueUIItem.
        public int HorizontalMargin 
        {
            get
            {
                return hMargin;
            }
            set
            {
                hMargin = value;
            }
        }
        // Example property for which to provide a PropertyValueUIItem.
        public int VerticalMargin
        {
            get
            {
                return vMargin;
            }
            set
            {
                vMargin = value;
            }
        }

        // Field storing the value of the HorizontalMargin property.
        private int hMargin;

        // Field storing the value of the VerticalMargin property.
        private int vMargin;        

        // Base64-encoded serialized image data for image icon.
        private string imageBlob1 = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////////////////////////////////8L";
                
        // Constructor.
        public PropertyUIComponent(System.ComponentModel.IContainer
 container)
        {
            if( container != null )
                container.Add(this);
            hMargin = 0;        
            vMargin = 0;
        }

        // Default component constructor that specifies no container.
        public PropertyUIComponent() : this(null)
        {}

        // 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 = DeserializeFromBase64Text(imageBlob1);
                itemList.Add( new PropertyValueUIItem( img, new
 PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test
 ToolTip") );
            }
            if( propDesc.DisplayName.Equals( "VerticalMargin"
 ) )
            {
                Image img = DeserializeFromBase64Text(imageBlob1);
                img.RotateFlip(RotateFlipType.Rotate90FlipNone);
                itemList.Add( new PropertyValueUIItem( img, new
 PropertyValueUIItemInvokeHandler(this.marginInvoke), "Test
 ToolTip") );
            }
        }

        // Invoke handler associated with the PropertyValueUIItem objects
 
        // provided by the marginPropertyValueUIHandler.
        private void marginInvoke(System.ComponentModel.ITypeDescriptorContext
 context, System.ComponentModel.PropertyDescriptor propDesc, PropertyValueUIItem
 item)
        {
            MessageBox.Show("Test invoke message box");
        }

        // Component.Site override to add the marginPropertyValueUIHandler
        // when the component is sited, and to remove it when the site
 is 
        // set to null.
        public override System.ComponentModel.ISite Site
        {
            get
            {
                return base.Site;
            }
            set
            {                
                if( value != null )
                {
                    base.Site = value;
                    IPropertyValueUIService uiService = (IPropertyValueUIService)this.GetService(typeof(IPropertyValueUIService));
                    if( uiService != null )
                    
                        uiService.AddPropertyValueUIHandler( new
 PropertyValueUIHandler(this.marginPropertyValueUIHandler) );
                                        
                }
                else
                {
                    IPropertyValueUIService uiService = (IPropertyValueUIService)this.GetService(typeof(IPropertyValueUIService));
                    if( uiService != null )
                    
                        uiService.RemovePropertyValueUIHandler( new
 PropertyValueUIHandler(this.marginPropertyValueUIHandler) );
                                        
                    base.Site = value;
                }
            }
        }

        // This method can be used to retrieve an Image from a block
 
        // of Base64-encoded text.
        private Image DeserializeFromBase64Text(string
 text)
        {
            Image img = null;
            byte[] memBytes = Convert.FromBase64String(text);
            IFormatter formatter = new BinaryFormatter();
            MemoryStream stream = new MemoryStream(memBytes);
            img = (Image)formatter.Deserialize(stream);
            stream.Close();
            return img;
        }
    }
}
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Drawing;
using namespace System::Drawing::Design;
using namespace System::IO;
using namespace System::Runtime::Serialization;
using namespace System::Runtime::Serialization::Formatters::Binary;
using namespace System::Windows::Forms;
using namespace System::Windows::Forms::Design;

namespace PropertyValueUIServiceExample
{

   // This component obtains the IPropertyValueUIService and adds a
   // PropertyValueUIHandler that provides PropertyValueUIItem objects
   // which provide an image, ToolTip, and invoke event handler to
   // any properties named horizontalMargin and verticalMargin,
   // such as the example integer properties on this component.
   public ref class PropertyUIComponent: public
 System::ComponentModel::Component
   {
   public:

      property int horizontalMargin 
      {
         // Example property for which to provide a PropertyValueUIItem.
         int get()
         {
            return hMargin;
         }

         void set( int value
 )
         {
            hMargin = value;
         }

      }

      property int verticalMargin 
      {
         // Example property for which to provide a PropertyValueUIItem.
         int get()
         {
            return vMargin;
         }

         void set( int value
 )
         {
            vMargin = value;
         }

      }

   private:

      // Field storing the value of the horizontalMargin property.
      int hMargin;

      // Field storing the value of the verticalMargin property.
      int vMargin;

      // Base64-encoded serialized image data for image icon.
      String^ imageBlob1;

   public:

      // Constructor.
      PropertyUIComponent( System::ComponentModel::IContainer^ container )
      {
         imageBlob1 = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////////////////////////////////8L";
         if ( container != nullptr )
                  container->Add( this );

         hMargin = 0;
         vMargin = 0;
      }


      // Default component constructor that specifies no container.
      PropertyUIComponent()
      {
         imageBlob1 = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD///////////////////////////////////8L";
         hMargin = 0;
         vMargin = 0;
      }


   private:

      // PropertyValueUIHandler delegate that provides PropertyValueUIItem
      // objects to any properties named horizontalMargin or verticalMargin.
      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 = DeserializeFromBase64Text( imageBlob1 );
            itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler(
 this, &PropertyUIComponent::marginInvoke ),"Test ToolTip"
 ) );
         }

         if ( propDesc->DisplayName->Equals( "verticalMargin"
 ) )
         {
            Image^ img = DeserializeFromBase64Text( imageBlob1 );
            img->RotateFlip( RotateFlipType::Rotate90FlipNone );
            itemList->Add( gcnew PropertyValueUIItem( img,gcnew PropertyValueUIItemInvokeHandler(
 this, &PropertyUIComponent::marginInvoke ),"Test ToolTip"
 ) );
         }
      }

      // Invoke handler associated with the PropertyValueUIItem objects
      // provided by the marginPropertyValueUIHandler.
      void marginInvoke( System::ComponentModel::ITypeDescriptorContext^
 /*context*/, System::ComponentModel::PropertyDescriptor^ /*propDesc*/, PropertyValueUIItem^
 /*item*/ )
      {
         MessageBox::Show( "Test invoke message box" );
      }

   public:

      property System::ComponentModel::ISite^ Site 
      {
         // Component::Site  to add the marginPropertyValueUIHandler
         // when the component is sited, and to remove it when the site
 is
         // set to 0.
         virtual System::ComponentModel::ISite^ get() override
         {
            return __super::Site;
         }

         virtual void set( System::ComponentModel::ISite^
 value ) override
         {
            if ( value != nullptr )
            {
               __super::Site = value;
               IPropertyValueUIService^ uiService = dynamic_cast<IPropertyValueUIService^>(this->GetService(
 IPropertyValueUIService::typeid ));
               if ( uiService != nullptr )
                              uiService->AddPropertyValueUIHandler( gcnew PropertyValueUIHandler(
 this, &PropertyUIComponent::marginPropertyValueUIHandler
 ) );
            }
            else
            {
               IPropertyValueUIService^ uiService = dynamic_cast<IPropertyValueUIService^>(this->GetService(
 IPropertyValueUIService::typeid ));
               if ( uiService != nullptr )
                              uiService->RemovePropertyValueUIHandler( gcnew PropertyValueUIHandler(
 this, &PropertyUIComponent::marginPropertyValueUIHandler
 ) );
               __super::Site = value;
            }
         }
      }

   private:

      // This method can be used to retrieve an Image from a block
      // of Base64-encoded text.
      Image^ DeserializeFromBase64Text( String^ text )
      {
         Image^ img = nullptr;
         array<Byte>^memBytes = Convert::FromBase64String( text );
         IFormatter^ formatter = gcnew BinaryFormatter;
         MemoryStream^ stream = gcnew MemoryStream( memBytes );
         img = dynamic_cast<Image^>(formatter->Deserialize( stream ));
         stream->Close();
         return img;
      }
   };
}
package PropertyValueUIServiceExample; 

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
import System.Drawing.*;
import System.Drawing.Design.*;
import System.IO.*; 
import System.Runtime.Serialization.*;
import System.Runtime.Serialization.Formatters.Binary.*;
import System.Windows.Forms.*;
import System.Windows.Forms.Design.*;
   
// This component obtains the IPropertyValueUIService and adds a
// PropertyValueUIHandler that provides PropertyValueUIItem objects
// which provide an image, ToolTip, and invoke event handler to
// any properties named HorizontalMargin and VerticalMargin, 
// such as the example integer properties on this component.    
public class PropertyUIComponent extends System.ComponentModel.Component
{
    // Example property for which to provide a PropertyValueUIItem.
    /** @property 
     */
    public int get_HorizontalMargin()
    {
        return hMargin;
    } //get_HorizontalMargin

    /** @property 
     */
    public void set_HorizontalMargin(int
 value)
    {
        hMargin = value;
    } //set_HorizontalMargin

    // Example property for which to provide a PropertyValueUIItem.
    /** @property 
     */
    public int get_VerticalMargin()
    {
        return vMargin;
    } //get_VerticalMargin

    /** @property 
     */
    public void set_VerticalMargin(int
 value)
    {
        vMargin = value;
    } //set_VerticalMargin

    // Field storing the value of the HorizontalMargin property.
    private int hMargin;

    // Field storing the value of the VerticalMargin property.
    private int vMargin;

    // Base64-encoded serialized image data for image icon.
    private String imageBlob1 = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJh"
        +"d2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0t"
        +"leVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYX"
        +"ABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIA"
        +"AAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD/////////////////////"
        +"//////////////8AAAD///////////////8AAAD///////8AAAD///////////////8"
        +"AAAD///////8AAAD///8AAAAAAAD///8AAAD///////8AAAD///8AAAAAAAD///8AAA"
        +"D///////8AAAD///////////////8AAAD///////8AAAD///////////////8AAAD//"
        +"/////////////////////////////////8L";

    // Constructor.
    public PropertyUIComponent(System.ComponentModel.IContainer
 container)
    {
        if (container != null) {
            container.Add(this);
        }
        hMargin = 0;
        vMargin = 0;
    } //PropertyUIComponent

    // Default component constructor that specifies no container.
    public PropertyUIComponent()
    {
        this(null);
    } //PropertyUIComponent

    // 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.get_DisplayName().Equals("HorizontalMargin"))
 {
            Image img = DeserializeFromBase64Text(imageBlob1);

            itemList.Add(new PropertyValueUIItem(img, 
                new PropertyValueUIItemInvokeHandler(this.MarginInvoke)
,
                "Test ToolTip"));
        }
        if (propDesc.get_DisplayName().Equals("VerticalMargin"))
 {
            Image img = DeserializeFromBase64Text(imageBlob1);

            img.RotateFlip(RotateFlipType.Rotate90FlipNone);
            itemList.Add(new PropertyValueUIItem(img, 
                new PropertyValueUIItemInvokeHandler(this.MarginInvoke)
,
                "Test ToolTip"));
        }
    } //MarginPropertyValueUIHandler

    // Invoke handler associated with the PropertyValueUIItem objects
 
    // provided by the MarginPropertyValueUIHandler.
    private void MarginInvoke(System.ComponentModel.
        ITypeDescriptorContext context, System.ComponentModel.
        PropertyDescriptor propDesc, PropertyValueUIItem item)
    {
        MessageBox.Show("Test invoke message box");
    } //MarginInvoke

    // Component.Site override to add the MarginPropertyValueUIHandler
    // when the component is sited, and to remove it when the site is
 
    // set to null.
    /** @property
     */
    public System.ComponentModel.ISite get_Site()
    {
        return super.get_Site();
    } //get_Site

    /** @property 
     */
    public void set_Site(System.ComponentModel.ISite
 value)
    {
        if (value != null) {
            super.set_Site(value);

            IPropertyValueUIService uiService 
                = ((IPropertyValueUIService)(this.
                GetService(IPropertyValueUIService.class.ToType())));
            if (uiService != null) {
                uiService.AddPropertyValueUIHandler(
                    new PropertyValueUIHandler(
                    this.MarginPropertyValueUIHandler));
            }
        }
        else {
            IPropertyValueUIService uiService = ((IPropertyValueUIService)(
                this.GetService(IPropertyValueUIService.class.ToType())));
            if (uiService != null) {
                uiService.RemovePropertyValueUIHandler(
                    new PropertyValueUIHandler(
                    this.MarginPropertyValueUIHandler));
            }
            super.set_Site(value);
        }
    } //set_Site

    // This method can be used to retrieve an Image from a block 
    // of Base64-encoded text.
    private Image DeserializeFromBase64Text(String text)
    {
        Image img = null;
        ubyte memBytes[] = Convert.FromBase64String(text);
        IFormatter formatter = new BinaryFormatter();
        MemoryStream stream = new MemoryStream(memBytes);
        img = (Image)(formatter.Deserialize(stream));
        stream.Close();
        return img;
    } //DeserializeFromBase64Text
} //PropertyUIComponent
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IPropertyValueUIService メンバ
System.Drawing.Design 名前空間
PropertyValueUIHandler
PropertyValueUIItem

IPropertyValueUIService メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド AddPropertyValueUIHandler 指定した PropertyValueUIHandler をこのサービス追加します
パブリック メソッド GetPropertyUIValueItems 指定したコンテキストおよびプロパティ記述子特性一致する PropertyValueUIItem オブジェクト取得します
パブリック メソッド NotifyPropertyValueUIItemsChanged PropertyValueUIItem オブジェクトグローバル リスト変更されたことを IPropertyValueUIService 実装通知します
パブリック メソッド RemovePropertyValueUIHandler プロパティUI サービスから、指定した PropertyValueUIHandler削除します
参照参照

関連項目

IPropertyValueUIService インターフェイス
System.Drawing.Design 名前空間
PropertyValueUIHandler
PropertyValueUIItem

IPropertyValueUIService メンバ

プロパティ ブラウザ表示されるコンポーネントプロパティイメージツール ヒント、およびイベント ハンドラ管理するユーザー インターフェイス提供します

IPropertyValueUIService データ型公開されるメンバを以下の表に示します


パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド AddPropertyValueUIHandler 指定した PropertyValueUIHandler をこのサービス追加します
パブリック メソッド GetPropertyUIValueItems 指定したコンテキストおよびプロパティ記述子特性一致する PropertyValueUIItem オブジェクト取得します
パブリック メソッド NotifyPropertyValueUIItemsChanged PropertyValueUIItem オブジェクトグローバル リスト変更されたことを IPropertyValueUIService 実装通知します
パブリック メソッド RemovePropertyValueUIHandler プロパティUI サービスから、指定した PropertyValueUIHandler削除します
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント PropertyUIValueItemsChanged PropertyValueUIItem オブジェクトリスト変更されたときに発生します
参照参照

関連項目

IPropertyValueUIService インターフェイス
System.Drawing.Design 名前空間
PropertyValueUIHandler
PropertyValueUIItem



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「IPropertyValueUIService」の関連用語

IPropertyValueUIServiceのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



IPropertyValueUIServiceのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS