private void LoadMouseEvent(MouseButtons button, PointF location, MouseType type) { IDrawObj draw = Objs.LastOrDefault(obj => obj.CanSelect(location)); if (_mouseMovingObj != draw) { if (_mouseMovingObj != null) { _mouseMovingObj.LoadMouseLeaveEvent(); } _mouseMovingObj = draw; if (_mouseMovingObj != null) { _mouseMovingObj.LoadMouseEnterEvent(); } } if (_mouseMovingObj != null) { _mouseMovingObj.LoadMouseEvent(button, location, type); } }
public override void MouseDown(object sender, MouseButtons button, PointF location) { PointF pf = GetRevertScrollAndScalePointF(location); _downPoint = location; if (_create.MouseDown(button, location, pf)) { return; } base.MouseDown(sender, button, pf); if (button != MouseButtons.Left) { return; } if (_controlPoint.MouseDown(pf)) { return; } IDrawObj drawObj = Objs.LastOrDefault(obj => obj.CanSelect(pf)); if (drawObj != null) { if (Control.ModifierKeys == Keys.Control) { if (_selectedObjs.Contains(drawObj)) { _selectedObjs.Remove(drawObj); } else { _selectedObjs.Add(drawObj); } } else if (Control.ModifierKeys == Keys.Shift) { //最后选中的DrawObj位置移动到列表的最后 if (_selectedObjs.Contains(drawObj)) { _selectedObjs.Remove(drawObj); } _selectedObjs.Add(drawObj); } else { if (_selectedObjs.Contains(drawObj)) { _selectedObjs.Remove(drawObj); } else { _selectedObjs.Clear(); } _selectedObjs.Add(drawObj); } } else { _selectedObjs.Clear(); _isSelectFrame = true; _rectBk = Rectangle.Empty; } _controlPoint.ChangeSelectObj(_selectedObjs); _controlPoint.MouseDown(pf); }