StandardCommands 類別

定義

為大部分應用程式可用的標準命令集合定義識別項。

public ref class StandardCommands
public class StandardCommands
type StandardCommands = class
Public Class StandardCommands
繼承
StandardCommands
衍生

範例

下列程式代碼範例說明如何將 類別的成員 StandardCommands 加入 至 MenuCommand ,以及如何將 新增 MenuCommandIMenuCommandService

   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 類別將命令新增至設計工具選單,您必須呼叫 AddCommandIMenuCommandService 方法,並新增 MenuCommand 包含 CommandID from StandardCommands的 。

建構函式

StandardCommands()

初始化 StandardCommands 類別的新執行個體。

欄位

AlignBottom

取得 AlignBottom 命令的 CommandID。 此欄位為唯讀。

AlignHorizontalCenters

取得 AlignHorizontalCenters 命令的 CommandID。 此欄位為唯讀。

AlignLeft

取得 AlignLeft 命令的 CommandID。 此欄位為唯讀。

AlignRight

取得 AlignRight 命令的 CommandID。 此欄位為唯讀。

AlignToGrid

取得 AlignToGrid 命令的 CommandID。 此欄位為唯讀。

AlignTop

取得 AlignTop 命令的 CommandID。 此欄位為唯讀。

AlignVerticalCenters

取得 AlignVerticalCenters 命令的 CommandID。 此欄位為唯讀。

ArrangeBottom

取得 ArrangeBottom 命令的 CommandID。 此欄位為唯讀。

ArrangeIcons

取得 ArrangeIcons 命令的 CommandID。 此欄位為唯讀。

ArrangeRight

取得 ArrangeRight 命令的 CommandID。 此欄位為唯讀。

BringForward

取得 BringForward 命令的 CommandID。 此欄位為唯讀。

BringToFront

取得 BringToFront 命令的 CommandID。 此欄位為唯讀。

CenterHorizontally

取得 CenterHorizontally 命令的 CommandID。 此欄位為唯讀。

CenterVertically

取得 CenterVertically 命令的 CommandID。 此欄位為唯讀。

Copy

取得 Copy 命令的 CommandID。 此欄位為唯讀。

Cut

取得 Cut 命令的 CommandID。 此欄位為唯讀。

Delete

取得 Delete 命令的 CommandID。 此欄位為唯讀。

DocumentOutline

取得文件大綱命令的 CommandID。 此欄位為唯讀。

F1Help

取得 F1Help 命令的 CommandID。 此欄位為唯讀。

Group

取得 Group 命令的 CommandID。 此欄位為唯讀。

HorizSpaceConcatenate

取得 HorizSpaceConcatenate 命令的 CommandID。 此欄位為唯讀。

HorizSpaceDecrease

取得 HorizSpaceDecrease 命令的 CommandID。 此欄位為唯讀。

HorizSpaceIncrease

取得 HorizSpaceIncrease 命令的 CommandID。 此欄位為唯讀。

HorizSpaceMakeEqual

取得 HorizSpaceMakeEqual 命令的 CommandID。 此欄位為唯讀。

LineupIcons

取得 LineupIcons 命令的 CommandID。 此欄位為唯讀。

LockControls

取得 LockControls 命令的 CommandID。 此欄位為唯讀。

MultiLevelRedo

取得 MultiLevelRedo 命令的 CommandID。 此欄位為唯讀。

MultiLevelUndo

取得 MultiLevelUndo 命令的 CommandID。 此欄位為唯讀。

Paste

取得 Paste 命令的 CommandID。 此欄位為唯讀。

Properties

取得 Properties 命令的 CommandID。 此欄位為唯讀。

PropertiesWindow

取得 PropertiesWindow 命令的 CommandID。 此欄位為唯讀。

Redo

取得 Redo 命令的 CommandID。 此欄位為唯讀。

Replace

取得 Replace 命令的 CommandID。 此欄位為唯讀。

SelectAll

取得 SelectAll 命令的 CommandID。 此欄位為唯讀。

SendBackward

取得 SendBackward 命令的 CommandID。 此欄位為唯讀。

SendToBack

取得 SendToBack 命令的 CommandID。 此欄位為唯讀。

ShowGrid

取得 ShowGrid 命令的 CommandID。 此欄位為唯讀。

ShowLargeIcons

取得 ShowLargeIcons 命令的 CommandID。 此欄位為唯讀。

SizeToControl

取得 SizeToControl 命令的 CommandID。 此欄位為唯讀。

SizeToControlHeight

取得 SizeToControlHeight 命令的 CommandID。 此欄位為唯讀。

SizeToControlWidth

取得 SizeToControlWidth 命令的 CommandID。 此欄位為唯讀。

SizeToFit

取得 SizeToFit 命令的 CommandID。 此欄位為唯讀。

SizeToGrid

取得 SizeToGrid 命令的 CommandID。 此欄位為唯讀。

SnapToGrid

取得 SnapToGrid 命令的 CommandID。 此欄位為唯讀。

TabOrder

取得 TabOrder 命令的 CommandID。 此欄位為唯讀。

Undo

取得 Undo 命令的 CommandID。 此欄位為唯讀。

Ungroup

取得 Ungroup 命令的 CommandID。 此欄位為唯讀。

VerbFirst

取得第一個動詞命令集合。 此欄位為唯讀。

VerbLast

取得最後一個動詞命令集合。 此欄位為唯讀。

VertSpaceConcatenate

取得 VertSpaceConcatenate 命令的 CommandID。 此欄位為唯讀。

VertSpaceDecrease

取得 VertSpaceDecrease 命令的 CommandID。 此欄位為唯讀。

VertSpaceIncrease

取得 VertSpaceIncrease 命令的 CommandID。 此欄位為唯讀。

VertSpaceMakeEqual

取得 VertSpaceMakeEqual 命令的 CommandID。 此欄位為唯讀。

ViewCode

取得 ViewCode 命令的 CommandID。 此欄位為唯讀。

ViewGrid

取得 ViewGrid 命令的 CommandID。 此欄位為唯讀。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱