按鈕項目

定義使用者可以與之互動的專案。 按鈕可以是不同類型的:Button、MenuButton 和 SplitDropDown。

語法

<Button guid="guidMyCommandSet" id="MyCommand" priority="0x102" type="button">
  <Parent>... </Parent>
  <Icon>... </Icon>
  <CommandFlag>... </CommandFlag>
  <Strings>... </Strings>
</Button>

屬性和元素

下列章節說明屬性、子元素和父元素。

屬性

屬性 描述
guid 必要。 GUID/ID 命令標識符的 GUID。
id 必要。 GUID/ID 命令標識碼的標識碼。
priority 選擇性。 指定優先權的數值。
type 選擇性。 指定按鈕種類的列舉值。

如果未指定,請使用 Button。

Button
出現在工具列上的標準命令(通常是圖示按鈕)、功能表和操作功能表。

MenuButton
不會執行命令但會產生另一個功能表的功能表項。

SplitDropDown
控件,例如 Microsoft Word 中標準工具列上的 [復原] 和 [取消復原] 按鈕。
Condition 選擇性。 請參閱 條件屬性

子元素

元素 描述
父元素 選擇性。 按鈕的父元素。
Icon 元素 選擇性。 與按鈕相關聯的圖示。
命令旗標專案 必要。 Button 的有效 CommandFlag 值如下所示。

- AllowParams

- CommandWellOnly

- DefaultDisabled

- DefaultInvisible

- DontCache

- DynamicItemStart

- DynamicVisibility

- FixMenuController

- IconAndText

- NoButtonCustomize

- NoCustomize

- NoKeyCustomize

- NoShowOnMenuController

- Pict

- PostExec

- ProfferedCmd

- RouteToDocs

- TextCascadeUseBtn

- TextMenuUseButton

- TextChanges

- TextChangesButton

- TextContextUseButton

- TextMenuCtrlUseMenu

- TextMenuUseButton

- TextOnly
Strings 元素 必要。 必須定義子 ButtonText 元素
註釋 選擇性批注。

父元素

元素 描述
Buttons 元素 將 Button 元素分組。

範例

下列範例會定義 .vsct 檔案中的按鈕。

<Button guid="guidMenuTextCmdSet" id="cmdidMyCommand" priority="0x0100" type="Button">
   <Parent guid="guidMenuTextCmdSet" id="MyMenuGroup" />
   <Icon guid="guidImages" id="bmpPic1" />
   <CommandFlag>TextChanges</CommandFlag>
   <Strings>
         <CommandName>cmdidMyCommand</CommandName>
         <ButtonText>My Command name</ButtonText>
   </Strings>
</Button>

另請參閱