コード例 #1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            const int WM_KEYDOWN    = 0x100;
            const int WM_SYSKEYDOWN = 0x104;

            if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
            {
                switch (keyData)
                {
                case Keys.Down:
                    this.statusBarPanel2.Text = "Down";
                    this.statusBarPanel1.Text = "Trapped keystrokes ...";
                    break;

                case Keys.Up:
                    this.statusBarPanel2.Text = "Up";
                    this.statusBarPanel1.Text = "Trapped keystrokes ...";
                    break;

                case Keys.NumLock:
                    this.statusBarPanel2.Text = "NumLock";
                    this.statusBarPanel1.Text = "Trapped keystrokes ...";
                    break;

                case Keys.Escape:
                    this.statusBarPanel2.Text = "Escape";
                    this.statusBarPanel1.Text = "Trapped keystrokes ...";
                    ExitClass ec = new ExitClass();
                    ec.fnExitUniversal();        //invoke the method "fnExitUniversal" from the class "ExitClass"
                    break;

                    /*
                     * case Keys.Tab:
                     *     this.statusBarPanel1.Text="Tab Key Captured";
                     *     break;
                     *
                     * case Keys.Control | Keys.M:
                     *     this.statusBarPanel1.Text="<CTRL> + M Captured";
                     *     break;
                     *
                     * case Keys.Alt | Keys.Z:
                     *     this.statusBarPanel1.Text="<ALT> + Z Captured";
                     *     break;
                     */
                }
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
コード例 #2
0
        /*-----------------------------------------------------------------------*/

        private void btExit_Click(object sender, System.EventArgs e)
        {
            //ask user before quit
            //1.way

            /*
             * DialogResult dr=MessageBox.Show("Are you sure you want to quit ?","Confirm", MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation);
             * if (dr==DialogResult.Yes)
             * Application.Exit();
             */
            //2.way
            ExitClass ec = new ExitClass();

            ec.fnExitUniversal();     //invoke the method "fnExitUniversal" from the class "ExitClass"
        }
コード例 #3
0
        private void miExit_Click(object sender, System.EventArgs e)
        {
            ExitClass ec = new ExitClass();

            ec.fnExitUniversal();     //invoke the method "fnExitUniversal" from the class "ExitClass"
        }