예제 #1
0
        public override void OnKeyPress(ShapeKeyEventArgs args)
        {
            if (SelectedObject == null && args.Key == Keys.Enter)
            {
                BeginRenameType(args.Sender);
            }

            if (SelectedObject != null && args.Key == Keys.Enter)
            {
                if (SelectedObject is UmlTypeMember)
                {
                    BeginRenameProperty(args.Sender, (UmlTypeMember)SelectedObject);
                }
            }

            if (SelectedObject == null && args.Key == Keys.Delete)
            {
                args.Sender.Diagram.Shapes.Remove(this);
                args.Redraw = true;
            }

            if (SelectedObject != null && args.Key == Keys.Delete)
            {
                if (SelectedObject is UmlTypeMember)
                {
                    DeleteSelectedMember();
                    args.Redraw = true;
                }
            }
        }
예제 #2
0
        private void MainCanvas_KeyDown(object sender, KeyEventArgs e)
        {
            if (EditMode == EditMode.Normal)
            {
                if (currentShape != null)
                {
                    Shape shape = currentShape;
                    var   args  = new ShapeKeyEventArgs
                    {
                        SnapToGrid = SnapToGrid, Sender = this, GridSize = GridSize, Key = e.KeyCode
                    };

                    shape.OnKeyPress(args);

                    if (args.Redraw)
                    {
                        Refresh();
                    }
                }
            }
        }
예제 #3
0
 public virtual void OnKeyPress(ShapeKeyEventArgs args)
 {
 }