共用方式為


IVsUIShell4.CreateToolbarTray(IOleCommandTarget, IVsToolbarTrayHost) Method

Definition

Attaches toolbars that are not contained inside a IVsWindowFrame.

public:
 int CreateToolbarTray(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pCmdTarget, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolbarTrayHost ^ % ppToolbarTrayHost);
public:
 int CreateToolbarTray(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget ^ pCmdTarget, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolbarTrayHost ^ &  ppToolbarTrayHost);
int CreateToolbarTray(Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget const & pCmdTarget, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsToolbarTrayHost const & & ppToolbarTrayHost);
public int CreateToolbarTray (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget pCmdTarget, out Microsoft.VisualStudio.Shell.Interop.IVsToolbarTrayHost ppToolbarTrayHost);
abstract member CreateToolbarTray : Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget * IVsToolbarTrayHost -> int
Public Function CreateToolbarTray (pCmdTarget As IOleCommandTarget, ByRef ppToolbarTrayHost As IVsToolbarTrayHost) As Integer

Parameters

pCmdTarget
IOleCommandTarget

[in] The command target for the tool bar.

ppToolbarTrayHost
IVsToolbarTrayHost

[out] The toolbar tray host.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

This method is similar to the SetupToolbar() alternatives, but allows you to attach toolbars that are not contained inside a IVsWindowFrame, such as dialogs. The IVsToolbarTrayHost instance it returns allows you to add toolbars and to retrieve the IVsUIElement that represents the UI element for the toolbar tray.

Applies to