public bool ContainsPoint(float X, float Y, bool CtrlPressed) { //bool result = false; for (int i = _Item.Count - 1; i >= 0; i--) { // if (result) return result; Item It = (Item)_Item[i]; switch (It.TypeShape) { case Nows.Line: Line L = (Line)_Item[i]; if (L.ContainsPoint(X, Y)) { if (CtrlPressed) { _Item.RemoveAt(i); } return(true); } break; case Nows.Rec: Rec R = (Rec)_Item[i]; if (R.ContainsPoint(X, Y)) { if (CtrlPressed) { _Item.RemoveAt(i); } return(true); } break; case Nows.Ellip: case Nows.Pie: Pie P = (Pie)_Item[i]; if (P.ContainsPoint(X, Y)) { if (CtrlPressed) { _Item.RemoveAt(i); } return(true); } break; case Nows.Group: GroupItem GI = (GroupItem)_Item[i]; if (GI.ContainsPoint(X, Y)) { if (CtrlPressed) { _Item.RemoveAt(i); } return(true); } break; default: break; } } return(false); }