ComponentDesigner クラス

定義

コンポーネントのデザイン モードの動作を拡張します。

public ref class ComponentDesigner : IDisposable, System::ComponentModel::Design::IDesigner, System::ComponentModel::Design::IDesignerFilter
public ref class ComponentDesigner : IDisposable, System::ComponentModel::Design::IComponentInitializer, System::ComponentModel::Design::IDesignerFilter, System::ComponentModel::Design::ITreeDesigner
public class ComponentDesigner : IDisposable, System.ComponentModel.Design.IDesigner, System.ComponentModel.Design.IDesignerFilter
public class ComponentDesigner : IDisposable, System.ComponentModel.Design.IComponentInitializer, System.ComponentModel.Design.IDesignerFilter, System.ComponentModel.Design.ITreeDesigner
type ComponentDesigner = class
    interface IDesigner
    interface IDisposable
    interface IDesignerFilter
type ComponentDesigner = class
    interface ITreeDesigner
    interface IDesigner
    interface IDisposable
    interface IDesignerFilter
    interface IComponentInitializer
Public Class ComponentDesigner
Implements IDesigner, IDesignerFilter, IDisposable
Public Class ComponentDesigner
Implements IComponentInitializer, IDesignerFilter, IDisposable, ITreeDesigner
継承
ComponentDesigner
派生
実装

次のコード例では、実装例 ComponentDesigner と、デザイナーに関連付けられているコンポーネントの例を示します。 デザイナーは、基本Initializeメソッドを呼び出すメソッドのInitializeオーバーライド、コンポーネントがダブルクリックされたときに をMessageBox表示するメソッドのDoDefaultActionオーバーライド、およびコンポーネントのショートカット メニューにカスタム DesignerVerb メニュー コマンドを提供するプロパティ アクセサーのVerbsオーバーライドを実装します。

#using <System.dll>
#using <System.Design.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Drawing;
using namespace System::Windows::Forms;

// Provides an example component designer.
ref class ExampleComponentDesigner: public ComponentDesigner
{
public:
   ExampleComponentDesigner()
   {
   }

   // This method provides an opportunity to perform processing when a designer is initialized.
   // The component parameter is the component that the designer is associated with.
   virtual void Initialize( IComponent^ component ) override
   {
      // Always call the base Initialize method in an of this method.
      ComponentDesigner::Initialize( component );
   }

   // This method is invoked when the associated component is double-clicked.
   virtual void DoDefaultAction() override
   {
      MessageBox::Show( "The event handler for the default action was invoked." );
   }

   // This method provides designer verbs.
   property DesignerVerbCollection^ Verbs 
   {
      virtual DesignerVerbCollection^ get() override
      {
         array<DesignerVerb^>^ newDesignerVerbs = {gcnew DesignerVerb( "Example Designer Verb Command", gcnew EventHandler( this, &ExampleComponentDesigner::onVerb ) )};
         return gcnew DesignerVerbCollection( newDesignerVerbs );
      }
   }

private:
   // Event handling method for the example designer verb
   void onVerb( Object^ sender, EventArgs^ e )
   {
      MessageBox::Show( "The event handler for the Example Designer Verb Command was invoked." );
   }
};

// Provides an example component associated with the example component designer.

[DesignerAttribute(ExampleComponentDesigner::typeid, IDesigner::typeid)]
ref class ExampleComponent: public Component
{
public:
   ExampleComponent(){}
};
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Windows.Forms;

namespace ExampleComponent
{	
    // Provides an example component designer.
    public class ExampleComponentDesigner : System.ComponentModel.Design.ComponentDesigner
    {
        public ExampleComponentDesigner()
        {
        }

        // This method provides an opportunity to perform processing when a designer is initialized.
        // The component parameter is the component that the designer is associated with.
        public override void Initialize(System.ComponentModel.IComponent component)
        {
            // Always call the base Initialize method in an override of this method.
            base.Initialize(component);
        }

        // This method is invoked when the associated component is double-clicked.
        public override void DoDefaultAction()
        {
            MessageBox.Show("The event handler for the default action was invoked.");
        }

        // This method provides designer verbs.
        public override System.ComponentModel.Design.DesignerVerbCollection Verbs
        {
            get
            {
                return new DesignerVerbCollection( new DesignerVerb[] { new DesignerVerb("Example Designer Verb Command", new EventHandler(this.onVerb)) } );
            }
        }

        // Event handling method for the example designer verb
        private void onVerb(object sender, EventArgs e)
        {
            MessageBox.Show("The event handler for the Example Designer Verb Command was invoked.");
        }
    }

    // Provides an example component associated with the example component designer.
    [DesignerAttribute(typeof(ExampleComponentDesigner), typeof(IDesigner))]
    public class ExampleComponent : System.ComponentModel.Component
    {		
        public ExampleComponent()
        {
        }
    }
}
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Windows.Forms

Namespace ExampleComponent

    ' Provides an example component designer.
    Public Class ExampleComponentDesigner
        Inherits System.ComponentModel.Design.ComponentDesigner

        Public Sub New()
        End Sub

        ' This method provides an opportunity to perform processing when a designer is initialized.
        ' The component parameter is the component that the designer is associated with.
        Public Overrides Sub Initialize(ByVal component As System.ComponentModel.IComponent)
            ' Always call the base Initialize method in an override of this method.
            MyBase.Initialize(component)
        End Sub

        ' This method is invoked when the associated component is double-clicked.
        Public Overrides Sub DoDefaultAction()
            MessageBox.Show("The event handler for the default action was invoked.")
        End Sub

        ' This method provides designer verbs.
        Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
            Get
                Return New DesignerVerbCollection(New DesignerVerb() {New DesignerVerb("Example Designer Verb Command", New EventHandler(AddressOf Me.onVerb))})
            End Get
        End Property

        ' Event handling method for the example designer verb
        Private Sub onVerb(ByVal sender As Object, ByVal e As EventArgs)
            MessageBox.Show("The event handler for the Example Designer Verb Command was invoked.")
        End Sub
    End Class

    ' Provides an example component associated with the example component designer.
    <DesignerAttribute(GetType(ExampleComponentDesigner), GetType(IDesigner))> _
     Public Class ExampleComponent
        Inherits System.ComponentModel.Component

        Public Sub New()
        End Sub
    End Class

End Namespace 'ExampleComponent

注釈

基本デザイナー クラスは ComponentDesigner 、関連付けられたコンポーネントの動作をデザイン モードで拡張できる単純なデザイナーを提供します。

ComponentDesigner は空 IDesignerFilter のインターフェイス実装を提供します。そのメソッドは、デザイン時に関連付けられたコンポーネントの属性、プロパティ、およびイベントを調整するためにオーバーライドできます。

デザイナーを 型に関連付けるには、 DesignerAttributeを使用します。 デザイン時の動作のカスタマイズの概要については、「 Design-Time サポートの拡張」を参照してください。

クラスは ComponentDesigner 、継承されたコンポーネントのプロパティ記述子に対して特別な動作を実装します。 という名前 InheritedPropertyDescriptor の内部型は、基底クラスから継承されるプロパティの代わりに、既定 ComponentDesigner の実装で使用されます。 これらのプロパティ記述子が追加されるケースは 2 つあります。

  1. 基底クラスから継承しているため、 プロパティによって IDesignerHost.RootComponent 返されるルート オブジェクト自体。

  2. ルート オブジェクトの基底クラスで見つかったフィールド。 基本クラスのパブリック フィールドと保護されたフィールドは、ユーザーが操作できるようにデザイナーに追加されます。

クラスは InheritedPropertyDescriptor 、プロパティの既定値を変更して、既定値がオブジェクトのインスタンス化時の現在の値になるようにします。 これは、 プロパティが別のインスタンスから継承されるためです。 デザイナーは、継承されたクラスによって設定された値にプロパティ値を設定するようにプロパティ値をリセットすることを定義します。 この値は、メタデータに格納されている既定値とは異なる場合があります。

コンストラクター

ComponentDesigner()

ComponentDesigner クラスの新しいインスタンスを初期化します。

プロパティ

ActionLists

デザイナーに関連付けられているコンポーネントでサポートされているデザイン時アクション リストを取得します。

AssociatedComponents

デザイナーで管理されているコンポーネントに関連付けられているコンポーネントのコレクションを取得します。

Component

デザイナーがデザインするコンポーネントを取得します。

InheritanceAttribute

関連付けられているコンポーネントの継承の種類を示す属性を取得します。

Inherited

コンポーネントが継承されているかどうかを示す値を取得します。

ParentComponent

このデザイナーの親コンポーネントを取得します。

SetTextualDefaultProperty

コンポーネントのデザイン モードの動作を拡張します。

ShadowProperties

ユーザー設定値をオーバーライドするプロパティ値のコレクションを取得します。

Verbs

デサイナに関連付けられているコンポーネントがサポートしているデザイン時の動詞を取得します。

メソッド

Dispose()

ComponentDesigner によって使用されているすべてのリソースを解放します。

Dispose(Boolean)

ComponentDesigner によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

DoDefaultAction()

コンポーネントの既定イベントに対するメソッド シグネチャをソース コード ファイル内に作成し、コード内のその位置にカーソルを移動します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
Finalize()

ガベージ コレクションでオブジェクトがクリアされる前に、Dispose(false) を呼び出して、リソースの解放を試みます。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetService(Type)

デザイナーのコンポーネントのデザイン モード サイトから、指定した型のサービスの取得を試みます。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
Initialize(IComponent)

指定したコンポーネントをデザイナーで表示、編集、デザインできるように準備します。

InitializeExistingComponent(IDictionary)

既存のコンポーネントを再初期化します。

InitializeNewComponent(IDictionary)

新たに作成されたコンポーネントを初期化します。

InitializeNonDefault()
古い.
古い.

既定値以外の値に既に初期化されている、インポートされたコンポーネントの設定値を初期化します。

InvokeGetInheritanceAttribute(ComponentDesigner)

指定した InheritanceAttributeComponentDesigner を取得します。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
OnSetComponentDefaults()
古い.
古い.

コンポーネントの既定のプロパティを設定します。

PostFilterAttributes(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連の属性から、項目を変更または削除できるようにします。

PostFilterEvents(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連のイベントから、項目を変更または削除できるようにします。

PostFilterProperties(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連のプロパティから、項目を変更または削除できるようにします。

PreFilterAttributes(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連の属性に項目を追加できるようにします。

PreFilterEvents(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連のイベントに項目を追加できるようにします。

PreFilterProperties(IDictionary)

デザイナーが、TypeDescriptor を通じて公開する一連のプロパティに項目を追加できるようにします。

RaiseComponentChanged(MemberDescriptor, Object, Object)

コンポーネントが変更されたことを IComponentChangeService に通知します。

RaiseComponentChanging(MemberDescriptor)

コンポーネントが変更されようとしていることを IComponentChangeService に通知します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IDesignerFilter.PostFilterAttributes(IDictionary)

このメンバーの説明については、PostFilterAttributes(IDictionary) メソッドのトピックを参照してください。

IDesignerFilter.PostFilterEvents(IDictionary)

このメンバーの説明については、PostFilterEvents(IDictionary) メソッドのトピックを参照してください。

IDesignerFilter.PostFilterProperties(IDictionary)

このメンバーの説明については、PostFilterProperties(IDictionary) メソッドのトピックを参照してください。

IDesignerFilter.PreFilterAttributes(IDictionary)

このメンバーの説明については、PreFilterAttributes(IDictionary) メソッドのトピックを参照してください。

IDesignerFilter.PreFilterEvents(IDictionary)

このメンバーの説明については、PreFilterEvents(IDictionary) メソッドのトピックを参照してください。

IDesignerFilter.PreFilterProperties(IDictionary)

このメンバーの説明については、PreFilterProperties(IDictionary) メソッドのトピックを参照してください。

ITreeDesigner.Children

このメンバーの説明については、Children プロパティを参照してください。

ITreeDesigner.Parent

このメンバーの説明については、Parent プロパティを参照してください。

適用対象

こちらもご覧ください