StandardCommands 类

定义

定义大多数应用程序可用的标准命令集的标识符。

public ref class StandardCommands
public class StandardCommands
type StandardCommands = class
Public Class StandardCommands
继承
StandardCommands
派生

示例

下面的代码示例演示了如何将类的成员 StandardCommands 添加到 a MenuCommand 以及如何将类的成员添加到 MenuCommand 其中 IMenuCommandService

   public ref class CDesigner: public ComponentDesigner
   {
   public:
    [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")]
      virtual void Initialize( IComponent^ comp ) override
      {
         ComponentDesigner::Initialize( comp );
         IMenuCommandService^ mcs = static_cast<IMenuCommandService^>(comp->Site->GetService( IMenuCommandService::typeid ));
         MenuCommand^ mc = gcnew MenuCommand( gcnew EventHandler( this, &CDesigner::OnF1Help ),StandardCommands::F1Help );
         mc->Enabled = true;
         mc->Visible = true;
         mc->Supported = true;
         mcs->AddCommand( mc );
         System::Windows::Forms::MessageBox::Show( "Initialize() has been invoked." );
      }

   private:
      void OnF1Help( Object^ /*sender*/, EventArgs^ /*e*/ )
      {
         System::Windows::Forms::MessageBox::Show( "F1Help has been invoked." );
      }
   };
}
public class CDesigner : System.ComponentModel.Design.ComponentDesigner 
{
    public override void Initialize(IComponent comp) 
    {
        base.Initialize(comp);

        IMenuCommandService mcs = (IMenuCommandService)comp.Site.
                    GetService(typeof(IMenuCommandService));
        MenuCommand mc = new MenuCommand(new EventHandler(OnF1Help), StandardCommands.F1Help);
        mc.Enabled = true;
        mc.Visible = true;
        mc.Supported = true;
        mcs.AddCommand(mc);
        System.Windows.Forms.MessageBox.Show("Initialize() has been invoked.");
    }

    private void OnF1Help(object sender, EventArgs e) 
    {
        System.Windows.Forms.MessageBox.Show("F1Help has been invoked.");
    }
}
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Class CDesigner
    Inherits System.ComponentModel.Design.ComponentDesigner

    Public Overrides Sub Initialize(ByVal comp As IComponent)
        MyBase.Initialize(comp)

        Dim mcs As IMenuCommandService = CType(comp.Site.GetService(GetType(IMenuCommandService)), IMenuCommandService)
        Dim mc As New MenuCommand(New EventHandler(AddressOf OnF1Help), StandardCommands.F1Help)
        mc.Enabled = True
        mc.Visible = True
        mc.Supported = True
        mcs.AddCommand(mc)
        System.Windows.Forms.MessageBox.Show("Initialize() has been invoked.")
    End Sub

    Private Sub OnF1Help(ByVal sender As Object, ByVal e As EventArgs)
        System.Windows.Forms.MessageBox.Show("F1Help has been invoked.")
    End Sub
End Class

注解

此类定义 CommandID 可供设计器使用的标准命令的标识符。

若要将类中的 StandardCommands 命令添加到设计器菜单中,必须调用 AddCommand 方法 IMenuCommandService 并添加 MenuCommand 包含 CommandID from StandardCommands的命令。

构造函数

名称 说明
StandardCommands()

初始化 StandardCommands 类的新实例。

字段

名称 说明
AlignBottom

获取 CommandID AlignBottom 命令。 此字段是只读的。

AlignHorizontalCenters

获取 CommandID AlignHorizontalCenters 命令。 此字段是只读的。

AlignLeft

获取 CommandID AlignLeft 命令。 此字段是只读的。

AlignRight

获取 CommandID AlignRight 命令。 此字段是只读的。

AlignToGrid

获取 CommandID AlignToGrid 命令。 此字段是只读的。

AlignTop

获取 CommandID AlignTop 命令。 此字段是只读的。

AlignVerticalCenters

获取 CommandID AlignVerticalCenters 命令。 此字段是只读的。

ArrangeBottom

获取 CommandID ArrangeBottom 命令。 此字段是只读的。

ArrangeIcons

获取 CommandID ArrangeIcons 命令。 此字段是只读的。

ArrangeRight

获取 CommandID ArrangeRight 命令。 此字段是只读的。

BringForward

获取 CommandID BringForward 命令。 此字段是只读的。

BringToFront

获取 CommandID BringToFront 命令。 此字段是只读的。

CenterHorizontally

获取 CommandID CenterHorizontally 命令。 此字段是只读的。

CenterVertically

获取 CommandID CenterVertically 命令。 此字段是只读的。

Copy

获取 CommandID Copy 命令。 此字段是只读的。

Cut

获取 CommandID “剪切”命令。 此字段是只读的。

Delete

获取 CommandID Delete 命令。 此字段是只读的。

DocumentOutline

获取 CommandID 文档大纲命令。 此字段是只读的。

F1Help

获取 CommandID F1Help 命令。 此字段是只读的。

Group

获取 CommandID Group 命令。 此字段是只读的。

HorizSpaceConcatenate

获取 CommandID HorizSpaceConcatenate 命令。 此字段是只读的。

HorizSpaceDecrease

获取 CommandID HorizSpaceDecrease 命令。 此字段是只读的。

HorizSpaceIncrease

获取 CommandID HorizSpaceIncrease 命令。 此字段是只读的。

HorizSpaceMakeEqual

获取 CommandID HorizSpaceMakeEqual 命令。 此字段是只读的。

LineupIcons

获取 CommandID LineupIcons 命令。 此字段是只读的。

LockControls

获取 CommandID LockControls 命令。 此字段是只读的。

MultiLevelRedo

获取 CommandID MultiLevelRedo 命令。 此字段是只读的。

MultiLevelUndo

获取 CommandID MultiLevelUndo 命令。 此字段是只读的。

Paste

获取 CommandID “粘贴”命令。 此字段是只读的。

Properties

获取 CommandID Properties 命令。 此字段是只读的。

PropertiesWindow

获取 CommandID PropertiesWindow 命令。 此字段是只读的。

Redo

获取 CommandID Redo 命令。 此字段是只读的。

Replace

获取 CommandID Replace 命令。 此字段是只读的。

SelectAll

获取 CommandID SelectAll 命令。 此字段是只读的。

SendBackward

获取 CommandID SendBackward 命令。 此字段是只读的。

SendToBack

获取 CommandID SendToBack 命令。 此字段是只读的。

ShowGrid

获取 CommandID ShowGrid 命令。 此字段是只读的。

ShowLargeIcons

获取 CommandID ShowLargeIcons 命令。 此字段是只读的。

SizeToControl

获取 CommandID SizeToControl 命令。 此字段是只读的。

SizeToControlHeight

获取 CommandID SizeToControlHeight 命令。 此字段是只读的。

SizeToControlWidth

获取 CommandID SizeToControlWidth 命令。 此字段是只读的。

SizeToFit

获取 CommandID SizeToFit 命令。 此字段是只读的。

SizeToGrid

获取 CommandID SizeToGrid 命令。 此字段是只读的。

SnapToGrid

获取 CommandID SnapToGrid 命令。 此字段是只读的。

TabOrder

获取 CommandID TabOrder 命令。 此字段是只读的。

Undo

获取 CommandID 撤消命令。 此字段是只读的。

Ungroup

获取 CommandID Ungroup 命令。 此字段是只读的。

VerbFirst

获取一组谓词中的第一个。 此字段是只读的。

VerbLast

获取一组谓词中的最后一个。 此字段是只读的。

VertSpaceConcatenate

获取 CommandID VertSpaceConcatenate 命令。 此字段是只读的。

VertSpaceDecrease

获取 CommandID VertSpaceDecrease 命令。 此字段是只读的。

VertSpaceIncrease

获取 CommandID VertSpaceIncrease 命令。 此字段是只读的。

VertSpaceMakeEqual

获取 CommandID VertSpaceMakeEqual 命令。 此字段是只读的。

ViewCode

获取 CommandID ViewCode 命令。 此字段是只读的。

ViewGrid

获取 CommandID ViewGrid 命令。 此字段是只读的。

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅