예제 #1
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            // First modifier keys.
            switch (e.KeyCode)
            {
            case Keys.ControlKey:
                ControlKeyDown = false;
                break;

            case Keys.ShiftKey:
                ShiftKeyDown = false;
                break;
            }

            // Now we handle the relevant letter keys that are paired with the modifiers.
            if (ControlKeyDown && !ShiftKeyDown)
            {
                // Control+Letter shortcuts
                switch (e.KeyCode)
                {
                case Keys.S:
                    // Quick save
                    SaveMap(ParentWindow.CurrentWorkingFile);
                    break;

                case Keys.L:
                    // Quick load
                    LoadMap();
                    break;

                case Keys.Q:
                    // Exit application.
                    ParentWindow.ExitApplication();
                    break;

                case Keys.E:
                    // Export bitmap
                    ExportBitmap();
                    break;

                case Keys.Z:
                    // Undo previous actions
                    // TODO.
                    Console.WriteLine("Ctrl-Z");
                    break;
                }
            }
            else if (ControlKeyDown && ShiftKeyDown)
            {
                // Control + Shift + Letter shortcuts.
                switch (e.KeyCode)
                {
                case Keys.S:
                    // Quick save as.
                    SaveMap(null);
                    break;
                }
            }
        }