예제 #1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            // Anderenfalls wird die Liste mit den gezeichneten Objekten von hinten (damit
            // das oberste Objekte gefunden wird) durchgegangen und geprüft, über welchem
            // Objekt die Maus sich befindet.
            for (int i = fpArray.Count - 1; i >= 0; i--)
            {
                FieldPanel fp = fpArray[i];
                if (fp.Hit(e.Location))
                {
                    if (_movingGraphicObject != null)
                    {
                        controller.View.status = _movingGraphicObject.Key;
                    }
                    else
                    {
                        controller.View.status = 0;
                    }

                    fp.OnMouseUp(this, e);
                    _movingGraphicObject = null;
                    return;
                }
            }
            if (_movingGraphicObject != null)
            {
                _movingGraphicObject.Move(_movingGraphicObject.Start.X - _lastMouseLocation.X + 25, _movingGraphicObject.Start.Y - _lastMouseLocation.Y + 50);
                //_movingGraphicObject.Reset();
                this.Invalidate();
            }
            _movingGraphicObject = null;
        }
예제 #2
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     // Wenn die Maus außerhalb der Zeichenfläche gedrückt wurde, wird abgebrochen.
     //if (!_canvas.Contains(e.Location)) return;
     // Anderenfalls wird die Liste mit den gezeichneten Objekten von hinten (damit
     // das oberste Objekte gefunden wird) durchgegangen und geprüft, über welchem
     // Objekt die Maus sich befindet.
     for (int i = _graphicObjects.Count - 1; i >= 0; i--)
     {
         MyGraphicObject go = _graphicObjects[i];
         if (go.Hit(e.Location))
         {
             _movingGraphicObject = go;
             break;
         }
     }
     _lastMouseLocation = e.Location;
 }