다음을 통해 공유


Package.ParseToolboxResource Method

Definition

Overloads

ParseToolboxResource(TextReader, ResourceManager)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

ParseToolboxResource(TextReader, Guid)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

ParseToolboxResource(TextReader, ResourceManager)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

public:
 void ParseToolboxResource(System::IO::TextReader ^ resourceData, System::Resources::ResourceManager ^ localizedCategories);
public void ParseToolboxResource (System.IO.TextReader resourceData, System.Resources.ResourceManager localizedCategories);
member this.ParseToolboxResource : System.IO.TextReader * System.Resources.ResourceManager -> unit
Public Sub ParseToolboxResource (resourceData As TextReader, localizedCategories As ResourceManager)

Parameters

resourceData
TextReader

A text reader that provides toolbox item data in the format described in Remarks.

localizedCategories
ResourceManager

A resource manager that provides localized lookup names for the categories provided in the resource data. This parameter can be null, in which case the category names are directly used.

Remarks

The text resource that a VSPackage parses using ParseToolboxResource must be embedded in an assembly and name space accessible to the VSPackage.

Text resources should be added to an assembly by right-clicking on the assembly's project, selection Add and the New Item. From the New Item menu, then select Text File. Once the text file has been added to the project, set its Build Action property to Embedded Resource.

This method can be used to add items to the toolbox automatically. The resource data is passed in through the resourceData parameter and consists of a text file with the following format:

; Comment  
[CategoryName]  
<class name>, <assembly name>  

The category name can be localized through the localizedCategories resource manager that is passed into this method. The localizedCategories parameter may be null, in which case the category names are not localized.

The assembly name may either be a fully qualified name or a partial name. If a partial name is passed, the most recently accessed assembly with that partial name is loaded.

When processing assembly names, ParseToolboxResource, searches only directories specified in keys in the registry entry HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\AssemblyFolders, where <version> is the version number of the release of Visual Studio (for example, 8.0)

Note

The root path of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<Version> can be overridden with an alternate root when the Visual Studio shell is initialized, or use of DefaultRegistryRootAttribute. For more information see, Command-Line Switches and DefaultRegistryRootAttribute.

The format of sub-keys under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\AssemblyFolders is

Name Type Data Description
<FriendlyName> REG_SZ A string containing a fully qualified path to a directory which should contain assemblies used by Visual Studio. The key's name, <FriendlyName>, may be any value so long as it is unique. The key's data contains the full path to a directory containing assemblies to be searched by ParseToolboxResource

Any VSPackage needing to use ParseToolboxResource must register itself with the Visual Studio environment as providing Toolbox items.

The attribute ProvideToolboxItemsAttribute must be applied to the VSPackage's implementation of Package. Depending on the implementation of the VSPackage ProvideToolboxFormatAttribute and ProvideToolboxItemConfigurationAttribute may also be required.

For more information on writing a Toolbox item provider, see Advanced Toolbox Control Development.

Applies to

ParseToolboxResource(TextReader, Guid)

Parses an embedded text resource of appropriate format for information about which items should be added to the Toolbox.

public:
 void ParseToolboxResource(System::IO::TextReader ^ resourceData, Guid packageGuid);
public void ParseToolboxResource (System.IO.TextReader resourceData, Guid packageGuid);
member this.ParseToolboxResource : System.IO.TextReader * Guid -> unit
Public Sub ParseToolboxResource (resourceData As TextReader, packageGuid As Guid)

Parameters

resourceData
TextReader

A text reader that provides toolbox item data in the format described in Remarks.

packageGuid
Guid

The GUID of the VSPackage.

Remarks

The text resource that a VSPackage parses using ParseToolboxResource must be embedded in an assembly and name space accessible to the VSPackage.

Text resources should be added to an assembly by right-clicking on the assembly's project, selection Add and the New Item. From the New Item menu, then select Text File. Once the text file has been added to the project, set its Build Action property to Embedded Resource.

This method can be used to add items to the toolbox automatically. The resource data is passed in through the resourceData parameter and consists of a text file with the following format:

; Comment  
[CategoryName]  
<class name>, <assembly name>  

These resources will not be localized.

Applies to