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

ToolboxItemFilterAttribute クラス

ツールボックスの項目のために使用するフィルタ文字列およびフィルタ種類指定します

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

<SerializableAttribute> _
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple:=True, Inherited:=True)>
 _
Public NotInheritable Class
 ToolboxItemFilterAttribute
    Inherits Attribute
Dim instance As ToolboxItemFilterAttribute
[SerializableAttribute] 
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true,
 Inherited=true)] 
public sealed class ToolboxItemFilterAttribute
 : Attribute
[SerializableAttribute] 
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple=true,
 Inherited=true)] 
public ref class ToolboxItemFilterAttribute
 sealed : public Attribute
/** @attribute SerializableAttribute() */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true,
 Inherited=true) */ 
public final class ToolboxItemFilterAttribute
 extends Attribute
SerializableAttribute 
AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple=true,
 Inherited=true) 
public final class ToolboxItemFilterAttribute
 extends Attribute
解説解説

ToolboxItemFilterAttribute には、一致する属性またはコードを持つデザイナだけで使用するようにツールボックス項目をマークできる機構用意されています。一致する属性またはコードにより、ツールボックス内でツールボックス項目を有効にするか無効にするかが判断されます。

ToolboxItemFilterAttribute を ToolboxItem に適用して、項目を有効または無効にする時点指定するフィルタ文字列およびフィルタ種類を示すことができます。さらに、ToolboxItemFilterAttributeデザイナ適用して、そのデザイナツールボックスで項目を有効にするための必要条件を示すこともできます。この属性の型を使用すると、一致するフィルタ文字列を持つデザイナ使用されているときに、該当するツールボックス項目が常に有効になることを示します。このフィルタ種類は、ToolboxItemFilterType を使用して、FilterType プロパティ指定されフィルタ文字列一致するかどうか利用するか、利用する場合その方法、または項目を有効にするかどうか決定するためにカスタム コード使用するか、などを示します

使用例使用例

ToolboxItemFilterAttribute適用する方法次のコード例示します

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Diagnostics
Imports System.Drawing
Imports System.Drawing.Design
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

' This example contains an IRootDesigner that implements the IToolboxUser
 interface.
' This example demonstrates how to enable the GetToolSupported method
 of an IToolboxUser
' designer in order to disable specific toolbox items, and how to respond
 to the 
' invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser
 implementation.
' This example component class demonstrates the associated IRootDesigner
 which 
' implements the IToolboxUser interface. When designer view is invoked,
 Visual 
' Studio .NET attempts to display a design mode view for the class at
 the top 
' of a code file. This can sometimes fail when the class is one of multiple
 types 
' in a code file, and has a DesignerAttribute associating it with an
 IRootDesigner. 
' Placing a derived class at the top of the code file solves this problem.
 A 
' derived class is not typically needed for this reason, except that
 placing the 
' RootDesignedComponent class in another file is not a simple solution
 for a code 
' example that is packaged in one segment of code.

Public Class RootViewSampleComponent
    Inherits RootDesignedComponent
End Class

' The following attribute associates the SampleRootDesigner with this
 example component.
<DesignerAttribute(GetType(SampleRootDesigner), GetType(IRootDesigner))>
 _
Public Class RootDesignedComponent
    Inherits System.Windows.Forms.Control
End Class

' This example IRootDesigner implements the IToolboxUser interface and
 provides a 
' Windows Forms view technology view for its associated component using
 an internal 
' Control type.     
' The following ToolboxItemFilterAttribute enables the GetToolSupported
 method of this
' IToolboxUser designer to be queried to check for whether to enable
 or disable all 
' ToolboxItems which create any components whose type name begins with
 "System.Windows.Forms".
<ToolboxItemFilterAttribute("System.Windows.Forms",
 ToolboxItemFilterType.Custom)> _
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
Public Class SampleRootDesigner
    Inherits ParentControlDesigner
    Implements IRootDesigner, IToolboxUser

    ' Member field of custom type RootDesignerView, a control that is
 shown in the 
    ' design mode document window. This member is cached to reduce processing
 needed 
    ' to recreate the view control on each call to GetView().
    Private m_view As RootDesignerView

    ' This string array contains type names of components that should
 not be added to 
    ' the component managed by this designer from the Toolbox.  Any
 ToolboxItems whose 
    ' type name matches a type name in this array will be marked disabled
 according to  
    ' the signal returned by the IToolboxUser.GetToolSupported method
 of this designer.
    Private blockedTypeNames As String()
 = {"System.Windows.Forms.ListBox", "System.Windows.Forms.GroupBox"}

    ' IRootDesigner.SupportedTechnologies is a required override for
 an IRootDesigner.
    ' This designer provides a display using the Windows Forms view
 technology.
    ReadOnly Property SupportedTechnologies()
 As ViewTechnology() Implements IRootDesigner.SupportedTechnologies
        Get
            Return New ViewTechnology() {ViewTechnology.Default}
        End Get
    End Property

    ' This method returns an object that provides the view for this
 root designer. 
    Function GetView(ByVal technology As
 ViewTechnology) As Object Implements
 IRootDesigner.GetView
        ' If the design environment requests a view technology other
 than Windows 
        ' Forms, this method throws an Argument Exception.
        If technology <> ViewTechnology.Default Then
            Throw New ArgumentException("An
 unsupported view technology was requested", "Unsupported
 view technology.")
        End If

        ' Creates the view object if it has not yet been initialized.
        If m_view Is Nothing
 Then
            m_view = New RootDesignerView(Me)
        End If
        Return m_view
    End Function

    ' This method can signal whether to enable or disable the specified
    ' ToolboxItem when the component associated with this designer is
 selected.
    Function GetToolSupported(ByVal tool As
 ToolboxItem) As Boolean Implements
 IToolboxUser.GetToolSupported
        ' Search the blocked type names array for the type name of the
 tool
        ' for which support for is being tested. Return false to indicate
 the
        ' tool should be disabled when the associated component is selected.
        Dim i As Integer
        For i = 0 To blockedTypeNames.Length
 - 1
            If tool.TypeName = blockedTypeNames(i) Then
                Return False
            End If
        Next i ' Return true to indicate support
 for the tool, if the type name of the
        ' tool is not located in the blockedTypeNames string array.
        Return True
    End Function

    ' This method can perform behavior when the specified tool has been
 invoked.
    ' Invocation of a ToolboxItem typically creates a component or components,
 
    ' and adds any created components to the associated component.
    Sub ToolPicked(ByVal tool As
 ToolboxItem) Implements IToolboxUser.ToolPicked
    End Sub

    ' This control provides a Windows Forms view technology view object
 that 
    ' provides a display for the SampleRootDesigner.
    <DesignerAttribute(GetType(ParentControlDesigner), GetType(IDesigner))>
 _
    Friend Class RootDesignerView
        Inherits Control
        ' This field stores a reference to a designer.
        Private m_designer As IDesigner

        Public Sub New(ByVal
 designer As IDesigner)
            ' Performs basic control initialization.
            m_designer = designer
            BackColor = Color.Blue
            Font = New Font(Font.FontFamily.Name, 24.0F)
        End Sub

        ' This method is called to draw the view for the SampleRootDesigner.
        Protected Overrides Sub
 OnPaint(ByVal pe As PaintEventArgs)
            MyBase.OnPaint(pe)
            ' Draws the name of the component in large letters.
            pe.Graphics.DrawString(m_designer.Component.Site.Name, Font, Brushes.Yellow,
 New RectangleF(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width,
 ClientRectangle.Height))
        End Sub
    End Class
End Class
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;

// This example contains an IRootDesigner that implements the IToolboxUser
 interface.
// This example demonstrates how to enable the GetToolSupported method
 of an IToolboxUser
// designer in order to disable specific toolbox items, and how to respond
 to the 
// invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser
 implementation.
namespace IToolboxUserExample
{
    // This example component class demonstrates the associated IRootDesigner
 which 
    // implements the IToolboxUser interface. When designer view is
 invoked, Visual 
    // Studio .NET attempts to display a design mode view for the class
 at the top 
    // of a code file. This can sometimes fail when the class is one
 of multiple types 
    // in a code file, and has a DesignerAttribute associating it with
 an IRootDesigner. 
    // Placing a derived class at the top of the code file solves this
 problem. A 
    // derived class is not typically needed for this reason, except
 that placing the 
    // RootDesignedComponent class in another file is not a simple solution
 for a code 
    // example that is packaged in one segment of code.
    public class RootViewSampleComponent :
 RootDesignedComponent
    {
    }

    // The following attribute associates the SampleRootDesigner with
 this example component.
    [DesignerAttribute(typeof(SampleRootDesigner), typeof(IRootDesigner))]
    public class RootDesignedComponent : System.Windows.Forms.Control
    {
    }

    // This example IRootDesigner implements the IToolboxUser interface
 and provides a 
    // Windows Forms view technology view for its associated component
 using an internal 
    // Control type.     
    // The following ToolboxItemFilterAttribute enables the GetToolSupported
 method of this
    // IToolboxUser designer to be queried to check for whether to enable
 or disable all 
    // ToolboxItems which create any components whose type name begins
 with "System.Windows.Forms".
    [ToolboxItemFilterAttribute("System.Windows.Forms", ToolboxItemFilterType.Custom)]
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name = "FullTrust")] 
    public class SampleRootDesigner : ParentControlDesigner,
 IRootDesigner, IToolboxUser
    {
        // This field is a custom Control type named RootDesignerView.
 This field references
        // a control that is shown in the design mode document window.
        private RootDesignerView view;

        // This string array contains type names of components that
 should not be added to 
        // the component managed by this designer from the Toolbox.
  Any ToolboxItems whose 
        // type name matches a type name in this array will be marked
 disabled according to  
        // the signal returned by the IToolboxUser.GetToolSupported
 method of this designer.
        private string[] blockedTypeNames =
        {
            "System.Windows.Forms.ListBox",
            "System.Windows.Forms.GroupBox"
        };

        // IRootDesigner.SupportedTechnologies is a required override
 for an IRootDesigner.
        // This designer provides a display using the Windows Forms
 view technology.
        ViewTechnology[] IRootDesigner.SupportedTechnologies 
        {
            get { return new
 ViewTechnology[] {ViewTechnology.Default}; }
        }

        // This method returns an object that provides the view for
 this root designer. 
        object IRootDesigner.GetView(ViewTechnology technology) 
        {
            // If the design environment requests a view technology
 other than Windows 
            // Forms, this method throws an Argument Exception.
            if (technology != ViewTechnology.Default)        
    
                throw new ArgumentException("An unsupported
 view technology was requested", 
                "Unsupported view technology.");            
            
            // Creates the view object if it has not yet been initialized.
            if (view == null)             
               
                view = new RootDesignerView(this);
          
  
            return view;
        }

        // This method can signal whether to enable or disable the specified
        // ToolboxItem when the component associated with this designer
 is selected.
        bool IToolboxUser.GetToolSupported(ToolboxItem tool)
        {       
            // Search the blocked type names array for the type name
 of the tool
            // for which support for is being tested. Return false to
 indicate the
            // tool should be disabled when the associated component
 is selected.
            for( int i=0; i<blockedTypeNames.Length;
 i++ )
                if( tool.TypeName == blockedTypeNames[i] )
                    return false;
            
            // Return true to indicate support for the tool, if the
 type name of the
            // tool is not located in the blockedTypeNames string array.
            return true;
        }
    
        // This method can perform behavior when the specified tool
 has been invoked.
        // Invocation of a ToolboxItem typically creates a component
 or components, 
        // and adds any created components to the associated component.
        void IToolboxUser.ToolPicked(ToolboxItem tool)
        {
        }

        // This control provides a Windows Forms view technology view
 object that 
        // provides a display for the SampleRootDesigner.
        [DesignerAttribute(typeof(ParentControlDesigner), typeof(IDesigner))]
        internal class RootDesignerView : Control
        {
            // This field stores a reference to a designer.
            private IDesigner m_designer;

            public RootDesignerView(IDesigner designer)
            {
                // Perform basic control initialization.
                m_designer = designer;
                BackColor = Color.Blue;
                Font = new Font(Font.FontFamily.Name, 24.0f);
                
            }

            // This method is called to draw the view for the SampleRootDesigner.
            protected override void OnPaint(PaintEventArgs
 pe)
            {
                base.OnPaint(pe);
                // Draw the name of the component in large letters.
                pe.Graphics.DrawString(m_designer.Component.Site.Name, Font, Brushes.Yellow,
 ClientRectangle);
            }
        }
    }
}
継承階層継承階層
System.Object
   System.Attribute
    System.ComponentModel.ToolboxItemFilterAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolboxItemFilterAttribute メンバ
System.ComponentModel 名前空間
ToolboxItemFilterType

ToolboxItemFilterAttribute コンストラクタ (String, ToolboxItemFilterType)

フィルタ文字列フィルタ種類指定して、ToolboxItemFilterAttribute クラス新しインスタンス初期化します。

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

Public Sub New ( _
    filterString As String, _
    filterType As ToolboxItemFilterType _
)
Dim filterString As String
Dim filterType As ToolboxItemFilterType

Dim instance As New ToolboxItemFilterAttribute(filterString,
 filterType)
public ToolboxItemFilterAttribute (
    string filterString,
    ToolboxItemFilterType filterType
)
public:
ToolboxItemFilterAttribute (
    String^ filterString, 
    ToolboxItemFilterType filterType
)
public ToolboxItemFilterAttribute (
    String filterString, 
    ToolboxItemFilterType filterType
)
public function ToolboxItemFilterAttribute
 (
    filterString : String, 
    filterType : ToolboxItemFilterType
)

パラメータ

filterString

ツールボックス項目のフィルタ文字列

filterType

フィルタ種類を示す ToolboxItemFilterType。

使用例使用例

ToolboxItemFilterAttribute適用する方法次のコード例示します

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Diagnostics
Imports System.Drawing
Imports System.Drawing.Design
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

' This example contains an IRootDesigner that implements the IToolboxUser
 interface.
' This example demonstrates how to enable the GetToolSupported method
 of an IToolboxUser
' designer in order to disable specific toolbox items, and how to respond
 to the 
' invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser
 implementation.
' This example component class demonstrates the associated IRootDesigner
 which 
' implements the IToolboxUser interface. When designer view is invoked,
 Visual 
' Studio .NET attempts to display a design mode view for the class at
 the top 
' of a code file. This can sometimes fail when the class is one of multiple
 types 
' in a code file, and has a DesignerAttribute associating it with an
 IRootDesigner. 
' Placing a derived class at the top of the code file solves this problem.
 A 
' derived class is not typically needed for this reason, except that
 placing the 
' RootDesignedComponent class in another file is not a simple solution
 for a code 
' example that is packaged in one segment of code.

Public Class RootViewSampleComponent
    Inherits RootDesignedComponent
End Class

' The following attribute associates the SampleRootDesigner with this
 example component.
<DesignerAttribute(GetType(SampleRootDesigner), GetType(IRootDesigner))>
 _
Public Class RootDesignedComponent
    Inherits System.Windows.Forms.Control
End Class

' This example IRootDesigner implements the IToolboxUser interface and
 provides a 
' Windows Forms view technology view for its associated component using
 an internal 
' Control type.     
' The following ToolboxItemFilterAttribute enables the GetToolSupported
 method of this
' IToolboxUser designer to be queried to check for whether to enable
 or disable all 
' ToolboxItems which create any components whose type name begins with
 "System.Windows.Forms".
<ToolboxItemFilterAttribute("System.Windows.Forms",
 ToolboxItemFilterType.Custom)> _
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
Public Class SampleRootDesigner
    Inherits ParentControlDesigner
    Implements IRootDesigner, IToolboxUser

    ' Member field of custom type RootDesignerView, a control that is
 shown in the 
    ' design mode document window. This member is cached to reduce processing
 needed 
    ' to recreate the view control on each call to GetView().
    Private m_view As RootDesignerView

    ' This string array contains type names of components that should
 not be added to 
    ' the component managed by this designer from the Toolbox.  Any
 ToolboxItems whose 
    ' type name matches a type name in this array will be marked disabled
 according to  
    ' the signal returned by the IToolboxUser.GetToolSupported method
 of this designer.
    Private blockedTypeNames As String()
 = {"System.Windows.Forms.ListBox", "System.Windows.Forms.GroupBox"}

    ' IRootDesigner.SupportedTechnologies is a required override for
 an IRootDesigner.
    ' This designer provides a display using the Windows Forms view
 technology.
    ReadOnly Property SupportedTechnologies()
 As ViewTechnology() Implements IRootDesigner.SupportedTechnologies
        Get
            Return New ViewTechnology() {ViewTechnology.Default}
        End Get
    End Property

    ' This method returns an object that provides the view for this
 root designer. 
    Function GetView(ByVal technology As
 ViewTechnology) As Object Implements
 IRootDesigner.GetView
        ' If the design environment requests a view technology other
 than Windows 
        ' Forms, this method throws an Argument Exception.
        If technology <> ViewTechnology.Default Then
            Throw New ArgumentException("An
 unsupported view technology was requested", "Unsupported
 view technology.")
        End If

        ' Creates the view object if it has not yet been initialized.
        If m_view Is Nothing
 Then
            m_view = New RootDesignerView(Me)
        End If
        Return m_view
    End Function

    ' This method can signal whether to enable or disable the specified
    ' ToolboxItem when the component associated with this designer is
 selected.
    Function GetToolSupported(ByVal tool As
 ToolboxItem) As Boolean Implements
 IToolboxUser.GetToolSupported
        ' Search the blocked type names array for the type name of the
 tool
        ' for which support for is being tested. Return false to indicate
 the
        ' tool should be disabled when the associated component is selected.
        Dim i As Integer
        For i = 0 To blockedTypeNames.Length
 - 1
            If tool.TypeName = blockedTypeNames(i) Then
                Return False
            End If
        Next i ' Return true to indicate support
 for the tool, if the type name of the
        ' tool is not located in the blockedTypeNames string array.
        Return True
    End Function

    ' This method can perform behavior when the specified tool has been
 invoked.
    ' Invocation of a ToolboxItem typically creates a component or components,
 
    ' and adds any created components to the associated component.
    Sub ToolPicked(ByVal tool As
 ToolboxItem) Implements IToolboxUser.ToolPicked
    End Sub

    ' This control provides a Windows Forms view technology view object
 that 
    ' provides a display for the SampleRootDesigner.
    <DesignerAttribute(GetType(ParentControlDesigner), GetType(IDesigner))>
 _
    Friend Class RootDesignerView
        Inherits Control
        ' This field stores a reference to a designer.
        Private m_designer As IDesigner

        Public Sub New(ByVal
 designer As IDesigner)
            ' Performs basic control initialization.
            m_designer = designer
            BackColor = Color.Blue
            Font = New Font(Font.FontFamily.Name, 24.0F)
        End Sub

        ' This method is called to draw the view for the SampleRootDesigner.
        Protected Overrides Sub
 OnPaint(ByVal pe As PaintEventArgs)
            MyBase.OnPaint(pe)
            ' Draws the name of the component in large letters.
            pe.Graphics.DrawString(m_designer.Component.Site.Name, Font, Brushes.Yellow,
 New RectangleF(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width,
 ClientRectangle.Height))
        End Sub
    End Class
End Class
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;

// This example contains an IRootDesigner that implements the IToolboxUser
 interface.
// This example demonstrates how to enable the GetToolSupported method
 of an IToolboxUser
// designer in order to disable specific toolbox items, and how to respond
 to the 
// invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser
 implementation.
namespace IToolboxUserExample
{
    // This example component class demonstrates the associated IRootDesigner
 which 
    // implements the IToolboxUser interface. When designer view is
 invoked, Visual 
    // Studio .NET attempts to display a design mode view for the class
 at the top 
    // of a code file. This can sometimes fail when the class is one
 of multiple types 
    // in a code file, and has a DesignerAttribute associating it with
 an IRootDesigner. 
    // Placing a derived class at the top of the code file solves this
 problem. A 
    // derived class is not typically needed for this reason, except
 that placing the 
    // RootDesignedComponent class in another file is not a simple solution
 for a code 
    // example that is packaged in one segment of code.
    public class RootViewSampleComponent :
 RootDesignedComponent
    {
    }

    // The following attribute associates the SampleRootDesigner with
 this example component.
    [DesignerAttribute(typeof(SampleRootDesigner), typeof(IRootDesigner))]
    public class RootDesignedComponent : System.Windows.Forms.Control
    {
    }

    // This example IRootDesigner implements the IToolboxUser interface
 and provides a 
    // Windows Forms view technology view for its associated component
 using an internal 
    // Control type.     
    // The following ToolboxItemFilterAttribute enables the GetToolSupported
 method of this
    // IToolboxUser designer to be queried to check for whether to enable
 or disable all 
    // ToolboxItems which create any components whose type name begins
 with "System.Windows.Forms".
    [ToolboxItemFilterAttribute("System.Windows.Forms", ToolboxItemFilterType.Custom)]
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name = "FullTrust")] 
    public class SampleRootDesigner : ParentControlDesigner,
 IRootDesigner, IToolboxUser
    {
        // This field is a custom Control type named RootDesignerView.
 This field references
        // a control that is shown in the design mode document window.
        private RootDesignerView view;

        // This string array contains type names of components that
 should not be added to 
        // the component managed by this designer from the Toolbox.
  Any ToolboxItems whose 
        // type name matches a type name in this array will be marked
 disabled according to  
        // the signal returned by the IToolboxUser.GetToolSupported
 method of this designer.
        private string[] blockedTypeNames =
        {
            "System.Windows.Forms.ListBox",
            "System.Windows.Forms.GroupBox"
        };

        // IRootDesigner.SupportedTechnologies is a required override
 for an IRootDesigner.
        // This designer provides a display using the Windows Forms
 view technology.
        ViewTechnology[] IRootDesigner.SupportedTechnologies 
        {
            get { return new
 ViewTechnology[] {ViewTechnology.Default}; }
        }

        // This method returns an object that provides the view for
 this root designer. 
        object IRootDesigner.GetView(ViewTechnology technology) 
        {
            // If the design environment requests a view technology
 other than Windows 
            // Forms, this method throws an Argument Exception.
            if (technology != ViewTechnology.Default)        
    
                throw new ArgumentException("An unsupported
 view technology was requested", 
                "Unsupported view technology.");            
            
            // Creates the view object if it has not yet been initialized.
            if (view == null)             
               
                view = new RootDesignerView(this);
          
  
            return view;
        }

        // This method can signal whether to enable or disable the specified
        // ToolboxItem when the component associated with this designer
 is selected.
        bool IToolboxUser.GetToolSupported(ToolboxItem tool)
        {       
            // Search the blocked type names array for the type name
 of the tool
            // for which support for is being tested. Return false to
 indicate the
            // tool should be disabled when the associated component
 is selected.
            for( int i=0; i<blockedTypeNames.Length;
 i++ )
                if( tool.TypeName == blockedTypeNames[i] )
                    return false;
            
            // Return true to indicate support for the tool, if the
 type name of the
            // tool is not located in the blockedTypeNames string array.
            return true;
        }
    
        // This method can perform behavior when the specified tool
 has been invoked.
        // Invocation of a ToolboxItem typically creates a component
 or components, 
        // and adds any created components to the associated component.
        void IToolboxUser.ToolPicked(ToolboxItem tool)
        {
        }

        // This control provides a Windows Forms view technology view
 object that 
        // provides a display for the SampleRootDesigner.
        [DesignerAttribute(typeof(ParentControlDesigner), typeof(IDesigner))]
        internal class RootDesignerView : Control
        {
            // This field stores a reference to a designer.
            private IDesigner m_designer;

            public RootDesignerView(IDesigner designer)
            {
                // Perform basic control initialization.
                m_designer = designer;
                BackColor = Color.Blue;
                Font = new Font(Font.FontFamily.Name, 24.0f);
                
            }

            // This method is called to draw the view for the SampleRootDesigner.
            protected override void OnPaint(PaintEventArgs
 pe)
            {
                base.OnPaint(pe);
                // Draw the name of the component in large letters.
                pe.Graphics.DrawString(m_designer.Component.Site.Name, Font, Brushes.Yellow,
 ClientRectangle);
            }
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolboxItemFilterAttribute クラス
ToolboxItemFilterAttribute メンバ
System.ComponentModel 名前空間

ToolboxItemFilterAttribute コンストラクタ (String)


ToolboxItemFilterAttribute コンストラクタ

ToolboxItemFilterAttribute クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
ToolboxItemFilterAttribute (String) フィルタ文字列指定してToolboxItemFilterAttribute クラス新しインスタンス初期化します。
ToolboxItemFilterAttribute (String, ToolboxItemFilterType) フィルタ文字列フィルタ種類指定してToolboxItemFilterAttribute クラス新しインスタンス初期化します。
参照参照

関連項目

ToolboxItemFilterAttribute クラス
ToolboxItemFilterAttribute メンバ
System.ComponentModel 名前空間

ToolboxItemFilterAttribute プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

ToolboxItemFilterAttribute クラス
System.ComponentModel 名前空間
ToolboxItemFilterType

ToolboxItemFilterAttribute メソッド


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

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます2 つの ToolboxItemFilterAttribute オブジェクト等しかどうか判断します
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。  
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match オーバーライドされます指定したオブジェクト一致するフィルタ文字列持っているかどうか示します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。  
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ToolboxItemFilterAttribute クラス
System.ComponentModel 名前空間
ToolboxItemFilterType

ToolboxItemFilterAttribute メンバ

ツールボックスの項目のために使用するフィルタ文字列およびフィルタ種類指定します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ToolboxItemFilterAttribute オーバーロードされます。 ToolboxItemFilterAttribute クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます2 つToolboxItemFilterAttribute オブジェクト等しかどうか判断します
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。  
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match オーバーライドされます指定したオブジェクト一致するフィルタ文字列持っているかどうか示します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString オーバーライドされます。  
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ToolboxItemFilterAttribute クラス
System.ComponentModel 名前空間
ToolboxItemFilterType



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

辞書ショートカット

すべての辞書の索引

「ToolboxItemFilterAttribute」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS