ComponentDesigner クラスとは? わかりやすく解説

ComponentDesigner クラス

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

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

Public Class ComponentDesigner
    Implements ITreeDesigner, IDesigner, IDisposable, IDesignerFilter,
 _
    IComponentInitializer
Dim instance As ComponentDesigner
public class ComponentDesigner : ITreeDesigner,
 IDesigner, IDisposable, 
    IDesignerFilter, IComponentInitializer
public ref class ComponentDesigner : ITreeDesigner,
 IDesigner, IDisposable, 
    IDesignerFilter, IComponentInitializer
public class ComponentDesigner implements ITreeDesigner,
 IDesigner, 
    IDisposable, IDesignerFilter, IComponentInitializer
public class ComponentDesigner implements ITreeDesigner,
 IDesigner, 
    IDisposable, IDesignerFilter, IComponentInitializer
解説解説
使用例使用例

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

Imports System
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 'New

        ' 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 'Initialize

        ' 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 'DoDefaultAction

        ' 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 'onVerb
    End Class 'ExampleComponentDesigner

    ' 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 'New
    End Class 'ExampleComponent

End Namespace '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()
        {
        }
    }
}
#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(){}
};
package ExampleComponent;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
import System.Drawing.*;
import System.Windows.Forms.*;

// Provides an example component designer.
public class ExampleComponentDesigner
    extends System.ComponentModel.Design.ComponentDesigner
{
    public ExampleComponentDesigner()
    {
    } //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 void Initialize(System.ComponentModel.IComponent
 component)
    {
        // Always call the base Initialize method in an override of
 this method.
        super.Initialize(component);
    } //Initialize

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

    // This method provides designer verbs.
    /** @property 
     */
    public System.ComponentModel.Design.DesignerVerbCollection
 get_Verbs()
    {
        return new DesignerVerbCollection(new
 DesignerVerb[]
            { new DesignerVerb("Example Designer Verb Command"
,
            new EventHandler(this.OnVerb))
 });
    } //get_Verbs

    // 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.");
    } //OnVerb
} //ExampleComponentDesigner

// Provides an example component associated with the example component
 designer.
/** @attribute DesignerAttribute(ExampleComponentDesigner.class,
 IDesigner.class)
 */
public class ExampleComponent extends System.ComponentModel.Component
{
    public ExampleComponent()
    {
    } //ExampleComponent
} //ExampleComponent
継承階層継承階層
System.Object
  System.ComponentModel.Design.ComponentDesigner
     派生クラス
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ComponentDesigner メンバ
System.ComponentModel.Design 名前空間
IDesigner
IDesignerFilter
DesignerAttribute クラス
その他の技術情報
デザインサポート拡張
方法 : デザインサービスアクセスする


このページでは「.NET Framework クラス ライブラリ リファレンス」からComponentDesigner クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からComponentDesigner クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からComponentDesigner クラス を検索

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

辞書ショートカット

すべての辞書の索引

「ComponentDesigner クラス」の関連用語

ComponentDesigner クラスのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS