public virtual void OnMouseUp(MouseEventArgs e) { CC.panel.Capture = false; CC.UnselectAll(); CC.panel.Refresh(); isNewObjectAdded = false; }
/// <summary>添加新的图形对象</summary> protected void AddNewObject(DrawObject w) { CC.UnselectAll(); w.Selected = true; CC.graphicsList.Add(w); CC.panel.Capture = true; CC.panel.Refresh(); }
//清除选中对象 private void button3_Click(object sender, EventArgs e) { CC.UnselectAll(); activeTool = ToolType.Pointer; }
public override void OnMouseDown(MouseEventArgs e) { CC.isToolPoint = true; Point p = new Point(e.X, e.Y); selectMode = SelectionMode.None; int n = CC.SelectionCount; for (int i = n - 1; i >= 0; i--) { DrawObject w = CC.GetSelectedObject(i); int handleNumber = w.HitHandleTest(p); if (handleNumber > 0) { selectMode = SelectionMode.Size; resizedObject = w; resizedObjectHandle = handleNumber; CC.UnselectAll(); w.Selected = true; break; } } if (selectMode == SelectionMode.None) { int n1 = CC.graphicsList.Count; DrawObject w = null; //查找是否有对象被选中 for (int i = n1 - 1; i >= 0; i--) { if (CC.graphicsList[i].HitHandleTest(p) == 0) { w = CC.graphicsList[i]; break; } } if (w != null) { selectMode = SelectionMode.Move; if ((Control.ModifierKeys & Keys.Control) == 0 && !w.Selected) { CC.UnselectAll(); } w.Selected = true; CC.panel.Cursor = Cursors.SizeAll; } } if (selectMode == SelectionMode.None) { if ((Control.ModifierKeys & Keys.Control) == 0) { CC.UnselectAll(); } selectMode = SelectionMode.NetSelection; CC.IsDrawNetRectangle = true; } lastPoint.X = p.X; lastPoint.Y = p.Y; startPoint.X = p.X; startPoint.Y = p.Y; CC.panel.Capture = true; CC.NetRectangle = CC.GetNormalizedRectangle(startPoint, lastPoint); CC.panel.Refresh(); }