Επεξεργασία

Κοινή χρήση μέσω


StandardCommands Class

Definition

Defines identifiers for the standard set of commands that are available to most applications.

public ref class StandardCommands
public class StandardCommands
type StandardCommands = class
Public Class StandardCommands
Inheritance
StandardCommands
Derived

Examples

The following code example illustrates how to add a member of the StandardCommands class to a MenuCommand and how to add the MenuCommand to an 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

Remarks

This class defines CommandID identifiers for standard commands that are available to designers.

To add a command from the StandardCommands class to a designer menu, you must call the AddCommand method of an IMenuCommandService and add a MenuCommand that contains a CommandID from StandardCommands.

Constructors

StandardCommands()

Initializes a new instance of the StandardCommands class.

Fields

AlignBottom

Gets the CommandID for the AlignBottom command. This field is read-only.

AlignHorizontalCenters

Gets the CommandID for the AlignHorizontalCenters command. This field is read-only.

AlignLeft

Gets the CommandID for the AlignLeft command. This field is read-only.

AlignRight

Gets the CommandID for the AlignRight command. This field is read-only.

AlignToGrid

Gets the CommandID for the AlignToGrid command. This field is read-only.

AlignTop

Gets the CommandID for the AlignTop command. This field is read-only.

AlignVerticalCenters

Gets the CommandID for the AlignVerticalCenters command. This field is read-only.

ArrangeBottom

Gets the CommandID for the ArrangeBottom command. This field is read-only.

ArrangeIcons

Gets the CommandID for the ArrangeIcons command. This field is read-only.

ArrangeRight

Gets the CommandID for the ArrangeRight command. This field is read-only.

BringForward

Gets the CommandID for the BringForward command. This field is read-only.

BringToFront

Gets the CommandID for the BringToFront command. This field is read-only.

CenterHorizontally

Gets the CommandID for the CenterHorizontally command. This field is read-only.

CenterVertically

Gets the CommandID for the CenterVertically command. This field is read-only.

Copy

Gets the CommandID for the Copy command. This field is read-only.

Cut

Gets the CommandID for the Cut command. This field is read-only.

Delete

Gets the CommandID for the Delete command. This field is read-only.

DocumentOutline

Gets the CommandID for the Document Outline command. This field is read-only.

F1Help

Gets the CommandID for the F1Help command. This field is read-only.

Group

Gets the CommandID for the Group command. This field is read-only.

HorizSpaceConcatenate

Gets the CommandID for the HorizSpaceConcatenate command. This field is read-only.

HorizSpaceDecrease

Gets the CommandID for the HorizSpaceDecrease command. This field is read-only.

HorizSpaceIncrease

Gets the CommandID for the HorizSpaceIncrease command. This field is read-only.

HorizSpaceMakeEqual

Gets the CommandID for the HorizSpaceMakeEqual command. This field is read-only.

LineupIcons

Gets the CommandID for the LineupIcons command. This field is read-only.

LockControls

Gets the CommandID for the LockControls command. This field is read-only.

MultiLevelRedo

Gets the CommandID for the MultiLevelRedo command. This field is read-only.

MultiLevelUndo

Gets the CommandID for the MultiLevelUndo command. This field is read-only.

Paste

Gets the CommandID for the Paste command. This field is read-only.

Properties

Gets the CommandID for the Properties command. This field is read-only.

PropertiesWindow

Gets the CommandID for the PropertiesWindow command. This field is read-only.

Redo

Gets the CommandID for the Redo command. This field is read-only.

Replace

Gets the CommandID for the Replace command. This field is read-only.

SelectAll

Gets the CommandID for the SelectAll command. This field is read-only.

SendBackward

Gets the CommandID for the SendBackward command. This field is read-only.

SendToBack

Gets the CommandID for the SendToBack command. This field is read-only.

ShowGrid

Gets the CommandID for the ShowGrid command. This field is read-only.

ShowLargeIcons

Gets the CommandID for the ShowLargeIcons command. This field is read-only.

SizeToControl

Gets the CommandID for the SizeToControl command. This field is read-only.

SizeToControlHeight

Gets the CommandID for the SizeToControlHeight command. This field is read-only.

SizeToControlWidth

Gets the CommandID for the SizeToControlWidth command. This field is read-only.

SizeToFit

Gets the CommandID for the SizeToFit command. This field is read-only.

SizeToGrid

Gets the CommandID for the SizeToGrid command. This field is read-only.

SnapToGrid

Gets the CommandID for the SnapToGrid command. This field is read-only.

TabOrder

Gets the CommandID for the TabOrder command. This field is read-only.

Undo

Gets the CommandID for the Undo command. This field is read-only.

Ungroup

Gets the CommandID for the Ungroup command. This field is read-only.

VerbFirst

Gets the first of a set of verbs. This field is read-only.

VerbLast

Gets the last of a set of verbs. This field is read-only.

VertSpaceConcatenate

Gets the CommandID for the VertSpaceConcatenate command. This field is read-only.

VertSpaceDecrease

Gets the CommandID for the VertSpaceDecrease command. This field is read-only.

VertSpaceIncrease

Gets the CommandID for the VertSpaceIncrease command. This field is read-only.

VertSpaceMakeEqual

Gets the CommandID for the VertSpaceMakeEqual command. This field is read-only.

ViewCode

Gets the CommandID for the ViewCode command. This field is read-only.

ViewGrid

Gets the CommandID for the ViewGrid command. This field is read-only.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also