StandardCommands クラス
アセンブリ: System (system.dll 内)


このクラスは、デザイナが使用できる標準コマンドの CommandID 識別子を定義します。
コマンドを StandardCommands クラス からデザイナのメニューに追加するには、IMenuCommandService の AddCommand メソッドを呼び出し、StandardCommands からの CommandID を格納する MenuCommand を追加する必要があります。
![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、SharedState です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |

StandardCommands クラスのメンバを MenuCommand に追加し、MenuCommand を IMenuCommandService に追加するコード例を次に示します。
<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
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] 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."); } }
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." ); } }; }


System.ComponentModel.Design.StandardCommands
System.Windows.Forms.Design.MenuCommands


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- StandardCommands クラスのページへのリンク