public DrawingItem HitTest(Control owner, int x, int y) { for (int i = this.Count - 1; i >= 0; i--) { DrawingItem objDraw = this[i]; DrawGroupBox dgb = objDraw as DrawGroupBox; if (dgb != null) { DrawingItem di = dgb.HitTestChild(owner, x, y); if (di != null) { return(di); } else { if (objDraw.HitTest(owner, x, y)) { return(objDraw); } } } else if (objDraw.HitTest(owner, x, y)) { return(objDraw); } } return(null); }
public virtual DrawingItem HitTestChild(Control owner, int x, int y) { if (_items != null) { int x0 = x - this.Left; int y0 = y - this.Top; if (this.RotateAngle != 0) { PointF pf = DrawRect.ConvertPoint(this.RectF, this.RotateAngle, new PointF((float)x, (float)y)); x0 = (int)pf.X; y0 = (int)pf.Y; } for (int i = _items.Count - 1; i >= 0; i--) { DrawingItem obj = _items[i]; DrawGroupBox dgb = obj as DrawGroupBox; if (dgb != null) { DrawingItem o = dgb.HitTestChild(owner, x0, y0); if (o != null) { return(o); } } if (obj.HitTest(owner, x0, y0)) { return(obj); } } } return(null); }