Commands2.AddNamedCommand2 方法
更新:2007 年 11 月
建立一個由環境所儲存並可在下次環境啟動時使用的具名命令,即使該增益集於環境啟動時並未載入也一樣。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
Function AddNamedCommand2 ( _
AddInInstance As AddIn, _
Name As String, _
ButtonText As String, _
Tooltip As String, _
MSOButton As Boolean, _
Bitmap As Object, _
ByRef ContextUIGUIDs As Object(), _
vsCommandStatusValue As Integer, _
CommandStyleFlags As Integer, _
ControlType As vsCommandControlType _
) As Command
Dim instance As Commands2
Dim AddInInstance As AddIn
Dim Name As String
Dim ButtonText As String
Dim Tooltip As String
Dim MSOButton As Boolean
Dim Bitmap As Object
Dim ContextUIGUIDs As Object()
Dim vsCommandStatusValue As Integer
Dim CommandStyleFlags As Integer
Dim ControlType As vsCommandControlType
Dim returnValue As Command
returnValue = instance.AddNamedCommand2(AddInInstance, _
Name, ButtonText, Tooltip, MSOButton, _
Bitmap, ContextUIGUIDs, vsCommandStatusValue, _
CommandStyleFlags, ControlType)
Command AddNamedCommand2(
AddIn AddInInstance,
string Name,
string ButtonText,
string Tooltip,
bool MSOButton,
Object Bitmap,
ref Object[] ContextUIGUIDs,
int vsCommandStatusValue,
int CommandStyleFlags,
vsCommandControlType ControlType
)
Command^ AddNamedCommand2(
[InAttribute] AddIn^ AddInInstance,
[InAttribute] String^ Name,
[InAttribute] String^ ButtonText,
[InAttribute] String^ Tooltip,
[InAttribute] bool MSOButton,
[InAttribute] Object^ Bitmap,
[InAttribute] array<Object^>^% ContextUIGUIDs,
[InAttribute] int vsCommandStatusValue,
[InAttribute] int CommandStyleFlags,
[InAttribute] vsCommandControlType ControlType
)
function AddNamedCommand2(
AddInInstance : AddIn,
Name : String,
ButtonText : String,
Tooltip : String,
MSOButton : boolean,
Bitmap : Object,
ContextUIGUIDs : Object[],
vsCommandStatusValue : int,
CommandStyleFlags : int,
ControlType : vsCommandControlType
) : Command
參數
AddInInstance
型別:EnvDTE.AddIn必要項。AddIn 物件加入新命令。
Name
型別:System.String必要項。新命令名稱的簡短形式。AddNamedCommand2 以 Addins.Progid 為開頭建立唯一的名稱。
ButtonText
型別:System.String必要項。如果這個命令是繫結至以名稱而非圖示顯示的按鈕時,將會使用的名稱。
Tooltip
型別:System.String必要項。使用者將滑鼠指標停留在任何繫結至新命令的控制項上時,文字會顯示。
MSOButton
型別:System.Boolean必要項。表示具名命令按鈕圖片是否為 Office 圖片。True 表示為按鈕。如果 MSOButton 是 False,那麼 Bitmap 就是 Visual C++ 資源 DLL 中 16x16 點陣圖資源 (但不是圖示資源) 的 ID,而此 DLL 必須位在包含語言地區設定識別項 (Locale Identifier) (英文為 1033) 的資料夾中。
Bitmap
型別:System.Object選擇項,要顯示在按鈕上之點陣圖的 ID。
ContextUIGUIDs
型別:array<System.Object[]%選擇項,GUID 的 SafeArray,可以判斷何種環境內容 (即偵錯模式和設計模式等等) 會啟用這個命令。請參閱 vsCommandDisabledFlags。
vsCommandStatusValue
型別:System.Int32選擇項。在您提供 ContextUIGUIDs 但目前都不是現用中時,判斷命令的停用狀態是不可見還是灰色的。
CommandStyleFlags
型別:System.Int32vsCommandStyle 列舉型別中的值。控制為這個命令而加入的任何 UI 視覺化樣式。
ControlType
型別:EnvDTE80.vsCommandControlType定義建立 UI 時所加入的控制項型別。
傳回值
已建立的具名命令。
使用權限
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。