Exemple #1
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            CanvasControl canvas = ActiveChild.Canvas;

            if (e.KeyCode == Keys.Escape)
            {
                canvas.UnselectSelectedImages();
            }
            else if (e.KeyCode == Keys.Delete)
            {
                canvas.DeleteSelectedImages();
            }
            else if (e.Control && e.KeyCode == Keys.L)
            {
                if (UnLocked)
                {
                    Lock();
                }
                else
                {
                    Unlock();
                }
            }
            else if (e.Control && e.KeyCode == Keys.C)
            {
                ActiveChild.Copy();
            }
            else if (e.Control && e.KeyCode == Keys.V)
            {
                ActiveChild.Paste();
            }
            else if (e.Control && e.KeyCode == Keys.X)
            {
                ActiveChild.Cut();
            }
            else if (e.Control && e.KeyCode == Keys.Y)
            {
                //m_UndoRedoManager.Redo();
            }
            else if (e.Control && e.KeyCode == Keys.Z)
            {
                //m_UndoRedoManager.Undo();
            }
            else if (!canvas.m_SelectedImgList.IsEmpty())
            {
                foreach (var obj in canvas.m_SelectedImgList)
                {
                    if (e.KeyCode == Keys.Left)
                    {
                        obj.Move(-POINTS_TO_STEP, 0);
                    }
                    else if (e.KeyCode == Keys.Right)
                    {
                        obj.Move(POINTS_TO_STEP, 0);
                    }
                    else if (e.KeyCode == Keys.Up)
                    {
                        obj.Move(0, -POINTS_TO_STEP);
                    }
                    else if (e.KeyCode == Keys.Down)
                    {
                        obj.Move(0, POINTS_TO_STEP);
                    }

                    Invalidate(obj.Rect.InflateEx());
                }
            }

            base.OnKeyDown(e);
        }