/// <summary> /// Mouse is moved. /// None button is pressed, or left button is pressed. /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { Point pointscroll = GetEventPointInArea(drawArea, e); Point oldPoint = lastPoint; wasMove = true; // set cursor when mouse button is not pressed if (e.Button == MouseButtons.None) { Cursor cursor = null; for (int i = 0; i < drawArea.GraphicsList.Count; i++) { int n = drawArea.GraphicsList[i].HitTest(pointscroll); if (n > 0) { cursor = drawArea.GraphicsList[i].GetHandleCursor(n); break; } } if (cursor == null) { cursor = Cursors.Default; } drawArea.Cursor = cursor; return; } if (e.Button != MouseButtons.Left) { return; } /// Left button is pressed // Find difference between previous and current position int dx = e.X - lastPoint.X; int dy = e.Y - lastPoint.Y; lastPoint.X = e.X; lastPoint.Y = e.Y; // resize if (selectMode == SelectionMode.Size) { if (resizedObject != null) { resizedObject.MoveHandleTo(pointscroll, resizedObjectHandle); drawArea.SetDirty(); drawArea.Refresh(); drawArea.GraphicsList.Dirty = true; } } // move if (selectMode == SelectionMode.Move) { foreach (DrawObject o in drawArea.GraphicsList.Selection) { o.Move(dx, dy); } drawArea.Cursor = Cursors.SizeAll; drawArea.SetDirty(); drawArea.Refresh(); drawArea.GraphicsList.Dirty = true; } if (selectMode == SelectionMode.NetSelection) { // Remove old selection rectangle ControlPaint.DrawReversibleFrame( drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, oldPoint)), Color.Black, FrameStyle.Dashed); // Draw new selection rectangle ControlPaint.DrawReversibleFrame( drawArea.RectangleToScreen(DrawRectangle.GetNormalizedRectangle(startPoint, new Point(e.X, e.Y))), Color.Black, FrameStyle.Dashed); return; } }
/// <summary> /// Mouse is moved. /// None button is pressed, ot left button is pressed. /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { Point point = drawArea.BackTrackMouse(new Point(e.X, e.Y)); int al = drawArea.TheLayers.ActiveLayerIndex; wasMove = true; //toolTip.InitialDelay = 1; // set cursor when mouse button is not pressed if (e.Button == MouseButtons.None) { Cursor cursor = null; if (drawArea.TheLayers[al].Graphics != null) { // Hide tooltip in case it was displayed //toolTip.Hide(drawArea); for (int i = 0; i < drawArea.TheLayers[al].Graphics.Count; i++) { int n = drawArea.TheLayers[al].Graphics[i].HitTest(point); if (n > 0) { cursor = drawArea.TheLayers[al].Graphics[i].GetHandleCursor(n); break; } //if (n == 0) // toolTip.Show(drawArea.TheLayers[al].Graphics[i].TipText, drawArea, point, 250); } } if (cursor == null) { cursor = Cursors.Default; } drawArea.Cursor = cursor; return; } if (e.Button != MouseButtons.Left) { return; } // Left button is pressed // Find difference between previous and current position int dx = point.X - lastPoint.X; int dy = point.Y - lastPoint.Y; lastPoint.X = point.X; lastPoint.Y = point.Y; // resize if (selectMode == SelectionMode.Size) { if (resizedObject != null) { resizedObject.MoveHandleTo(point, resizedObjectHandle); drawArea.Refresh(); } } // move if (selectMode == SelectionMode.Move) { int n = drawArea.TheLayers[al].Graphics.SelectionCount; for (int i = 0; i < n; i++) { drawArea.TheLayers[al].Graphics.GetSelectedObject(i).Move(dx, dy); } drawArea.Cursor = Cursors.SizeAll; drawArea.Refresh(); } if (selectMode == SelectionMode.NetSelection) { drawArea.NetRectangle = DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint); drawArea.Refresh(); return; } }
public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { var point = new Point(e.X, e.Y); // óñòàíîâêà êóðñîðà, êîãäà ìûøü íå çàæàòà if (e.Button == MouseButtons.None) { Cursor cursor = null; for (int i = 0; i < drawArea.GraphicsList.Count; i++) { int n = drawArea.GraphicsList[i].HitTest(point); if (n > 0) { cursor = drawArea.GraphicsList[i].GetHandleCursor(n); break; } if (drawArea.GraphicsList[i].HitOnCircumferance) { cursor = drawArea.GraphicsList[i].GetOutlineCursor(n); break; } } if (cursor == null) { cursor = Cursors.Default; } drawArea.Cursor = cursor; return; } if (e.Button != MouseButtons.Left) { return; } // íàæàòèå ëåâîé êíîïêè // ðàçíèöà ìåæäó ïðåä. è òåê. ïîçèöèåé float dx = e.X - _lastPoint.X; float dy = e.Y - _lastPoint.Y; _lastPoint.X = e.X; _lastPoint.Y = e.Y; // ðåñàéç if (_selectMode == SelectionMode.Size) { if (_resizedObject != null) { _resizedObject.MoveHandleTo(point, _resizedObjectHandle); drawArea.SetDirty(); drawArea.Refresh(); } } // ñäâèã if (_selectMode == SelectionMode.Move) { int n = drawArea.GraphicsList.SelectionCount; for (int i = 0; i < n; i++) { drawArea.GraphicsList.GetSelectedObject(i).Move(dx, dy); } drawArea.Cursor = Cursors.SizeAll; drawArea.SetDirty(); drawArea.Refresh(); } if (_selectMode == SelectionMode.NetSelection) { drawArea.NetRectangle = DrawRectangle.GetNormalizedRectangle(_startPoint, _lastPoint); drawArea.Refresh(); return; } }
/// <summary> /// Mouse is moved. /// None button is pressed, ot left button is pressed. /// </summary> /// <param name="drawArea"></param> /// <param name="e"></param> public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { Point point = new Point(e.X, e.Y); // set cursor when mouse button is not pressed if (e.Button == MouseButtons.None) { Cursor cursor = null; for (int i = 0; i < drawArea.GraphicsList.Count; i++) { int n = drawArea.GraphicsList[i].HitTest(point); if (n > 0) { cursor = drawArea.GraphicsList[i].GetHandleCursor(n); break; } } if (cursor == null) { cursor = Cursors.Default; } drawArea.Cursor = cursor; return; } if (e.Button != MouseButtons.Left) { return; } /// Left button is pressed // Find difference between previous and current position int dx = e.X - lastPoint.X; int dy = e.Y - lastPoint.Y; lastPoint.X = e.X; lastPoint.Y = e.Y; // resize if (selectMode == SelectionMode.Size) { if (resizedObject != null) { resizedObject.MoveHandleTo(point, resizedObjectHandle); drawArea.SetDirty(); drawArea.Refresh(); } } // move if (selectMode == SelectionMode.Move) { int n = drawArea.GraphicsList.SelectionCount; for (int i = 0; i < n; i++) { drawArea.GraphicsList.GetSelectedObject(i).Move(dx, dy); } drawArea.Cursor = Cursors.SizeAll; drawArea.SetDirty(); drawArea.Refresh(); } if (selectMode == SelectionMode.NetSelection) { drawArea.NetRectangle = DrawRectangle.GetNormalizedRectangle(startPoint, lastPoint); drawArea.Refresh(); return; } }