Ejemplo n.º 1
0
        private void zoom(object sender, EventArgs e)
        {
            string tag = (string)((Button)sender).Tag;

            switch (tag)
            {
                case "zoomIn":
                    if (rectSize <= maxZoom)
                    {
                        ICommand zoomCom = new ZoomInCommand(this);
                        zoomCom.Execute();
                    }
                    break;
                case "zoomOut":
                    if (rectSize >= minZoom)
                    {
                        ICommand zoomOutCom = new ZoomOutCommand(this);
                        zoomOutCom.Execute();
                    }
                    break;
                default:
                    break;
            }

            InvalidateAndUpdate(gridPanel);
        }
Ejemplo n.º 2
0
 private void form_KeyDown(object sender, KeyEventArgs e)
 {
     switch (e.KeyCode)
     {
         case Keys.ControlKey:
             ctrlPressed = true;
             break;
         case Keys.ShiftKey:
             shiftPressed = true;
             break;
         case Keys.S:
             if (ctrlPressed)
             {
                 SaveMap(false);
             }
             break;
         case Keys.Oemplus:
             if (ctrlPressed)
             {
                 ICommand zoomCom = new ZoomInCommand(this);
                 zoomCom.Execute();
             }
             break;
         case Keys.OemMinus:
             if (ctrlPressed)
             {
                 ICommand zoomOutCom = new ZoomOutCommand(this);
                 zoomOutCom.Execute();
             }
             break;
     }
 }