コード例 #1
0
            protected override void OnClick(EventArgs e)
            {
                base.OnClick(e);

                CommandBarControl control = this.item as CommandBarControl;

                if (control != null)
                {
                    control.PerformClick(EventArgs.Empty);
                }
            }
コード例 #2
0
        private bool PerformClick(CommandBarItem item)
        {
            Application.DoEvents();

            CommandBarControl control = item as CommandBarControl;

            if (control != null)
            {
                control.PerformClick(EventArgs.Empty);
                return(true);
            }

            return(false);
        }
コード例 #3
0
        // [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));
        }