IVsToolbox2.AddItem2 Method
Adds an item to the referenced Toolbox tab, specifying a package GUID.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
‘선언
Function AddItem2 ( _
pDO As IDataObject, _
ptif As TBXITEMINFO(), _
lpszTab As String, _
ByRef guidPkg As Guid _
) As Integer
‘사용 방법
Dim instance As IVsToolbox2
Dim pDO As IDataObject
Dim ptif As TBXITEMINFO()
Dim lpszTab As String
Dim guidPkg As Guid
Dim returnValue As Integer
returnValue = instance.AddItem2(pDO, ptif, _
lpszTab, guidPkg)
int AddItem2(
IDataObject pDO,
TBXITEMINFO[] ptif,
string lpszTab,
ref Guid guidPkg
)
int AddItem2(
[InAttribute] IDataObject^ pDO,
[InAttribute] array<TBXITEMINFO>^ ptif,
[InAttribute] String^ lpszTab,
[InAttribute] Guid% guidPkg
)
abstract AddItem2 :
pDO:IDataObject *
ptif:TBXITEMINFO[] *
lpszTab:string *
guidPkg:Guid byref -> int
function AddItem2(
pDO : IDataObject,
ptif : TBXITEMINFO[],
lpszTab : String,
guidPkg : Guid
) : int
Parameters
- pDO
Type: Microsoft.VisualStudio.OLE.Interop.IDataObject
[in] Data object to add to the Toolbox.
- ptif
Type: array<Microsoft.VisualStudio.Shell.Interop.TBXITEMINFO[]
[in] Structure containing the item information to set for the data object. For a list of ptif values, see TBXITEMINFO.
- lpszTab
Type: System.String
[in] The localized name of the tab to add to the Toolbox. The localized name can be obtained from the invariant non-localized name by calling GetIDOfTab
- guidPkg
Type: System.Guid%
[in] GUID identifying the package adding the Toolbox item. Package GUID identifying your VSPackage.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsToolbox2::AddItem2(
[in]IDataObject* pDO,
[in]PTBXITEMINFO ptif,
[in]LPCOLESTR lpszTab,
[in]REFGUID guidPkg
);
The Toolbox uses the Package GUID to set the UI text for your Toolbox item. In the bstrText element of the TBXITEMINFO structure, you should specify a resource ID of the form "#number". This resource ID must then correspond to the UI string for the Toolbox item in your satellite DLL. The Toolbox persists the package GUID and resource ID for each Toolbox item. This enables it to reassign each Toolbox UI string in the event that the user changes the environment language (locale).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.