ComponentFactory.Krypton.Toolkit.ViewComposite.ViewFromPoint C# (CSharp) Method

ViewFromPoint() public method

Find the view that contains the specified point.
public ViewFromPoint ( Point pt ) : ViewBase
pt Point Point in view coordinates.
return ViewBase
        public override ViewBase ViewFromPoint(Point pt)
        {
            ViewBase ret = null;

            // Do we contain the point?
            if (ClientRectangle.Contains(pt))
            {
                // Give children a chance to specify a more accurate match but
                // we search the children in reverse order as the last child in
                // the collection is the top most in the z-order. The mouse is
                // therefore testing againt the most visible child first.
                foreach (ViewBase child in this.Reverse())
                {
                    // Only interested in children that are visible
                    if (child.Visible)
                    {
                        // Is the point inside the child area?
                        if (child.ClientRectangle.Contains(pt))
                        {
                            // Find child that wants the point
                            ret = child.ViewFromPoint(pt);
                            break;
                        }
                    }
                }

                // If none of the children, match then we do
                if (ret == null)
                    ret = this;
            }

            return ret;
        }