Exemple #1
0
        public override OperationReturnValue Execute()
        {
            /*
             * _line = (Line) OwnerDocument.CreateCADObject(ElementTypes.Line, this);
             * _line.Start = GetUserInput(event.MouseUp).Position;
             * _line.End = GetUserInput(event.MouseUp).Position;
             * return OperationReturnValue.EndOperation;
             */

            _line = (Line)OwnerDocument.CreateCADObject(ElementTypes.Line, this);
            EventArgs m;

            do
            {
                if (!WaitInput(UserInputEventType.MouseMove | UserInputEventType.MouseClick, out m))
                {
                    return(OperationReturnValue.CancelOperation);
                }
            } while (((MouseEventArgs)m).Button != MouseButtons.Left);

            SkipInput(5);

            _line.Start = new Point(MousePoint.Vertex);
            do
            {
                if (!WaitInput(UserInputEventType.MouseMove | UserInputEventType.MouseClick, out m))
                {
                    return(OperationReturnValue.CancelOperation);
                }
                _line.End = new Point(MousePoint.Vertex);
            } while (((MouseEventArgs)m).Button != MouseButtons.Left);
            _line.End = new Point(MousePoint.Vertex);
            return(OperationReturnValue.EndOperation);
        }