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

DesignerVerb クラス

デザイナから呼び出すことができる動詞表します

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

<ComVisibleAttribute(True)> _
Public Class DesignerVerb
    Inherits MenuCommand
[ComVisibleAttribute(true)] 
public class DesignerVerb : MenuCommand
[ComVisibleAttribute(true)] 
public ref class DesignerVerb : public
 MenuCommand
/** @attribute ComVisibleAttribute(true) */ 
public class DesignerVerb extends MenuCommand
ComVisibleAttribute(true) 
public class DesignerVerb extends
 MenuCommand
解説解説
使用例使用例

DesignerVerb オブジェクト作成しコンポーネントデザインショートカット メニュー追加するコード例次に示します

Imports System
Imports System.ComponentModel
Imports System.Collections
Imports System.ComponentModel.Design

'  This sample demonstrates a designer that adds menu commands
'   to the design-time shortcut menu for a component.
'
'   To test this sample, build the code for the component as a class
 library, 
'   add the resulting component to the toolbox, open a form in design
 mode, 
'   and drag the component from the toolbox onto the form. 
'
'   The component should appear in the component tray beneath the form.
 
'   Right-click the component.  The verbs should appear in the shortcut
 menu.

Namespace VBDesignerVerb
    ' Associate MyDesigner with this component type using a DesignerAttribute
    <Designer(GetType(MyDesigner))> _
    Public Class Component1
        Inherits System.ComponentModel.Component
    End Class 


    '  This is a designer class which provides designer verb menu commands
 for 
    '  the associated component. This code is called by the design environment
 at design-time.    
    Friend Class MyDesigner
        Inherits ComponentDesigner

        Private m_Verbs As DesignerVerbCollection

        ' DesignerVerbCollection is overridden from ComponentDesigner
        Public Overrides ReadOnly
 Property Verbs() As DesignerVerbCollection
            Get
                If m_Verbs Is Nothing
 Then
                    ' Create and initialize the collection of verbs
                    m_Verbs = New DesignerVerbCollection()
                    m_Verbs.Add( New DesignerVerb("First
 Designer Verb", New EventHandler(AddressOf
 OnFirstItemSelected)) )
                    m_Verbs.Add( New DesignerVerb("Second
 Designer Verb", New EventHandler(AddressOf
 OnSecondItemSelected)) )
                End If
                Return m_Verbs
            End Get
        End Property

        Sub New()
        End Sub 

        Private Sub OnFirstItemSelected(ByVal
 sender As Object, ByVal
 args As EventArgs)
            ' Display a message
            System.Windows.Forms.MessageBox.Show("The first designer
 verb was invoked.")
        End Sub 

        Private Sub OnSecondItemSelected(ByVal
 sender As Object, ByVal
 args As EventArgs)
            ' Display a message
            System.Windows.Forms.MessageBox.Show("The second designer
 verb was invoked.")
        End Sub 
    End Class 
End Namespace
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;

/* This sample demonstrates a designer that adds menu commands
    to the design-time shortcut menu for a component.

    To test this sample, build the code for
 the component as a class library, 
    add the resulting component to the toolbox, open a form in
 design mode, 
    and drag the component from the toolbox onto the form. 

    The component should appear in the component tray beneath
 the form. 
    Right-click the component.  The verbs should appear in the
 shortcut menu.
*/

namespace CSDesignerVerb
{
    // Associate MyDesigner with this component type using a DesignerAttribute
    [Designer(typeof(MyDesigner))]
    public class Component1 : System.ComponentModel.Component
    {
    }

    // This is a designer class which provides designer verb menu commands
 for 
    // the associated component. This code is called by the design environment
 at design-time.
    internal class MyDesigner : ComponentDesigner
    {
        DesignerVerbCollection m_Verbs;

        // DesignerVerbCollection is overridden from ComponentDesigner
        public override DesignerVerbCollection Verbs
        {
            get 
            {
                if (m_Verbs == null) 
                {
                    // Create and initialize the collection of verbs
                    m_Verbs = new DesignerVerbCollection();
            
                    m_Verbs.Add( new DesignerVerb("First
 Designer Verb", new EventHandler(OnFirstItemSelected))
 );
                    m_Verbs.Add( new DesignerVerb("Second
 Designer Verb", new EventHandler(OnSecondItemSelected))
 );
                }
                return m_Verbs;
            }
        }

        MyDesigner() 
        {
        }

        private void OnFirstItemSelected(object
 sender, EventArgs args) 
        {
            // Display a message
            System.Windows.Forms.MessageBox.Show("The first designer verb was
 invoked.");
        }

        private void OnSecondItemSelected(object
 sender, EventArgs args) 
        {
            // Display a message
            System.Windows.Forms.MessageBox.Show("The second designer verb was
 invoked.");
        }
    }
}
#using <system.dll>
#using <system.design.dll>
#using <system.windows.forms.dll>

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

/* This sample demonstrates a designer that adds menu commands
to the design-time shortcut menu for a component.

To test this sample, build the code for the
 component as a class library,
add the resulting component to the toolbox, open a form in design
 mode,
and drag the component from the toolbox onto the form.

The component should appear in the component tray beneath the
 form.
Right-click the component.  The verbs should appear in the shortcut
 menu.
*/
// This is a designer class which provides designer verb menu commands
 for
// the associated component. This code is called by the design environment
 at design-time.
private ref class MyDesigner: public
 ComponentDesigner
{
public:

   property DesignerVerbCollection^ Verbs 
   {
      // DesignerVerbCollection is overridden from ComponentDesigner
      virtual DesignerVerbCollection^ get() override
      {
         if ( m_Verbs == nullptr )
         {
            // Create and initialize the collection of verbs
            m_Verbs = gcnew DesignerVerbCollection;
            m_Verbs->Add( gcnew DesignerVerb( "First Designer Verb",gcnew
 EventHandler( this, &MyDesigner::OnFirstItemSelected ) )
 );
            m_Verbs->Add( gcnew DesignerVerb( "Second Designer Verb",gcnew
 EventHandler( this, &MyDesigner::OnSecondItemSelected )
 ) );
         }

         return m_Verbs;
      }
   }
   MyDesigner(){}

private:
   DesignerVerbCollection^ m_Verbs;
   void OnFirstItemSelected( Object^ /*sender*/, EventArgs^ /*args*/
 )
   {
      // Display a message
      MessageBox::Show( "The first designer verb was invoked." );
   }

   void OnSecondItemSelected( Object^ /*sender*/, EventArgs^ /*args*/
 )
   {
      // Display a message
      MessageBox::Show( "The second designer verb was invoked." );
   }
};

// Associate MyDesigner with this component type using a DesignerAttribute
[Designer(MyDesigner::typeid)]
public ref class Component1: public
 System::ComponentModel::Component{};
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.ComponentModel.Design.MenuCommand
    System.ComponentModel.Design.DesignerVerb
       System.Web.UI.Design.TemplateEditingVerb
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DesignerVerb メンバ
System.ComponentModel.Design 名前空間
MenuCommand
IMenuCommandService


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

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

辞書ショートカット

すべての辞書の索引

「DesignerVerb クラス」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS