protected override void OnClick(EventArgs e) { base.OnClick(e); CommandBarControl control = this.item as CommandBarControl; if (control != null) { control.PerformClick(EventArgs.Empty); } }
private bool PerformClick(CommandBarItem item) { Application.DoEvents(); CommandBarControl control = item as CommandBarControl; if (control != null) { control.PerformClick(EventArgs.Empty); return(true); } return(false); }
// [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] protected override bool ProcessCmdKey(ref Message message, Keys keyData) { CommandBarItem[] shortcutHits = this.items[keyData]; if (shortcutHits.Length != 0) { CommandBarControl control = shortcutHits[0] as CommandBarControl; if (control != null) { control.PerformClick(EventArgs.Empty); return(true); } } return(base.ProcessCmdKey(ref message, keyData)); }