コード例 #1
0
    /// <summary>
    /// This method will be called when the user has finished drawing a ghost rectangle or bundle
    /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command.
    /// </summary>
    protected override void GhostDrawingComplete() {
      if ((IsActive == false) ||
          (started == false)) {
        return;
      }

      try {
        SimpleEllipse shape = new SimpleEllipse(this.Controller.Model);
        shape.Width = (int)Rectangle.Width;
        shape.Height = (int)Rectangle.Height;
        AddShapeCommand cmd = new AddShapeCommand(
            this.Controller,
            shape,
            new Point((int)Rectangle.X, (int)Rectangle.Y));
        this.Controller.UndoManager.AddUndoCommand(cmd);
        cmd.Redo();
      }
      catch {
        base.Controller.DeactivateTool(this);
        Controller.View.Invalidate();
        throw;
      }

      //base.Controller.DeactivateTool(this);
    }
コード例 #2
0
        /// <summary>
        /// This method will be called when the user has finished drawing a ghost rectangle or bundle
        /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command.
        /// </summary>
        protected override void GhostDrawingComplete()
        {
            if ((IsActive == false) ||
                (started == false))
            {
                return;
            }

            try {
                SimpleEllipse shape = new SimpleEllipse(this.Controller.Model);
                shape.Width  = (int)Rectangle.Width;
                shape.Height = (int)Rectangle.Height;
                AddShapeCommand cmd = new AddShapeCommand(
                    this.Controller,
                    shape,
                    new Point((int)Rectangle.X, (int)Rectangle.Y));
                this.Controller.UndoManager.AddUndoCommand(cmd);
                cmd.Redo();
            }
            catch {
                base.Controller.DeactivateTool(this);
                Controller.View.Invalidate();
                throw;
            }

            //base.Controller.DeactivateTool(this);
        }