MenuCommand.Enabled Property
.NET Framework (current version)
Gets a value indicating whether this menu item is available.
Assembly: System (in System.dll)
The following code example creates a MenuCommand object, configures its properties, and adds it to IMenuCommandService.
[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."); } }
.NET Framework
Available since 1.1
Available since 1.1
Show: