コード例 #1
0
ファイル: MainForm.cs プロジェクト: rrossenbg/vprint
        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);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: rrossenbg/vprint
        private void ToolsButton_Click(object sender, EventArgs e)
        {
            if (sender == btnNew)
            {
                AddNewChild();
            }
            else
            {
                if (ActiveChild.Canvas.BackgroundImage == null)
                {
                    new NoImageFoundException().ThrowAndForget();
                    return;
                }

                if (sender == btnMouse)
                {
                    ActiveChild.SetEmptyTool();
                }
                else if (sender == btnSelect)
                {
                    ActiveChild.Lasso();
                }
                else if (sender == btnPen)
                {
                    ActiveChild.Pen();
                }
                else if (sender == btnPolioPen)
                {
                    ActiveChild.PolioPen();
                }
                else if (sender == btnCut)
                {
                    var allowCrop = SettingsTable.Get <bool>(Strings.VScan_AllowCropTool, false);
                    if (allowCrop)
                    {
                        ActiveChild.Cut();
                    }
                    else
                    {
                        new NotAllowedToolException().ThrowAndForget();
                    }
                }
                else if (sender == btnRubber)
                {
                    ActiveChild.Rubber();
                }
                else if (sender == btnRect)
                {
                    //TODO:
                }
                else if (sender == btnEllipse)
                {
                    //TODO:
                }
                else if (sender == btnText)
                {
                    ActiveChild.DoText();
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }