다음을 통해 공유


ProvideToolboxFormatAttribute Class

Apply this attribute to classes implementing VSPackages to declare that the VSPackage provides Toolbox items with the specified clipboard format and to enable drag-and-drop support in the Visual Studio Toolbox.

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)

Syntax

‘선언
<AttributeUsageAttribute(AttributeTargets.Class, Inherited := True, AllowMultiple := True)> _
Public NotInheritable Class ProvideToolboxFormatAttribute _
    Inherits Attribute
‘사용 방법
Dim instance As ProvideToolboxFormatAttribute
[AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public sealed class ProvideToolboxFormatAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, Inherited = true, AllowMultiple = true)]
public ref class ProvideToolboxFormatAttribute sealed : public Attribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Class, Inherited = true, AllowMultiple = true)>]
type ProvideToolboxFormatAttribute =  
    class
        inherit Attribute
    end
public final class ProvideToolboxFormatAttribute extends Attribute

Remarks

Attribute Context

Applies to

Classes providing VSPackages by implementing the IVsPackage interface or the Package interface.

Repeatable

Yes

Required attributes

ProvideToolboxItemsAttribute

Invalid attributes

None

This attribute is used only for registration purposes and does not affect runtime behavior.

Apply this attribute to classes implementing a VSPackage that either provides Toolbox items with a non-standard clipboard format or does not support one or more the default Toolbox clipboard formats.

A VSPackage without this attribute must support all default Toolbox clipboard types.

For a list of the default Toolbox clipboard types supported by a VSPackage, see Toolbox (Visual Studio SDK).

Use of this attribute by itself does not register a VSPackage as a provider of items with a given clipboard. An instance of the attribute must be applied to register the VSPackage as providing objects of the specified format.

Only one clipboard format is registered as supported for each instance of this attribute applied to a class. To indicate that multiple formats are supported, multiple instances of the attribute must be applied to the class.

Note   C# automatically appends the word "Attribute" to the name of any attribute class. In C# code, refer to this attribute as ProvideToolboxFormat.

Examples

In the example below the attributes applied to the MyPackage class indicates that it supports version 1 of Toolbox items with two clipboard formats: "CF_XMLCODE" and "InPlaceMenuEditorMenu".

    [DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]
    [ProvideToolboxItems(true, 1)]
    [ProvideToolboxFormat("CF_XMLCODE")]
    [ProvideToolboxFormat("InPlaceMenuEditorMenu")]
    [Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]
    internal sealed class MyPackage : Package

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.VisualStudio.Shell.ProvideToolboxFormatAttribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ProvideToolboxFormatAttribute Members

Microsoft.VisualStudio.Shell Namespace

ProvideToolboxFormatAttribute

Other Resources

Toolbox (Visual Studio SDK)