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 命令 ID 的 ID。

priority

可选。 指定优先级的数值。

type

可选。 指定该按钮的枚举值。

如果未指定,使用按。

Button

显示在工具栏的标准命令 (通常为个图标样式的按钮),菜单和上下文菜单。

MenuButton

不执行命令的菜单项,但是,生成另一个菜单。

SplitDropDown

控件,如撤消和重做在标准工具栏上的按钮 Microsoft Word。

Condition

可选。 请参见 VSCT XML 架构条件特性

子元素

元素

说明

Parent 元素

可选。 按钮的父元素。

Icon 元素

可选。 图标与按钮。

Command Flag 元素

必选。 按钮的有效 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 元素

组按钮元素。

示例

下面的示例定义了 .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>

请参见

其他资源

Visual Studio 命令 (表。Vsct) 文件