예제 #1
0
        private FindControlResult FindControl(ToolStrip ts, int x, int y)
        {
            var p    = ts.PointToClient(new Point(x, y));
            var item = GetAllChildren(ts).FirstOrDefault(c => c.Bounds.Contains(p));

            if (item == null)
            {
                var res = new FindControlResult(ts.Parent.RectangleToScreen(ts.Bounds), ts.Name);
                return(res);
            }
            else
            {
                var res = new FindControlResult(ts.RectangleToScreen(item.Bounds), item.Name);
                return(res);
            }
        }