/// <summary>
        /// Gets the lightweight control that is located at the specified client point and allows
        /// mouse wheel events.
        /// </summary>
        /// <param name="point">A point that contains the coordinates where you want to look for a
        /// control. Coordinates are expressed relative to the upper-left corner of the control's
        /// client area.</param>
        /// <returns>The BehaviorControl at the specified client point that allows mouse wheel
        /// events.  If there is no BehaviorControl at the specified client point that allows
        /// mouse wheel events, the GetBehaviorControlAtClientPoint method returns a null
        /// reference.</returns>
        private BehaviorControl GetMouseWheelBehaviorControlAtClientPoint(Point point)
        {
            //	Map the client point to a virtual client point.
            point = ClientPointToVirtualClientPoint(point);

            //	Enumerate the lightweight controls, in Z order, to locate one at the virtual point.
            for (int index = Controls.Count - 1; index >= 0; index--)
            {
                //	Access the lightweight control.
                BehaviorControl BehaviorControl = Controls[index];

                //	If the lightweight control is visible, and the virtual client point is inside
                //	it, translate the virtual client point to be relative to the location of the
                //	lightweight control and recursively ask the lightweight control to return the
                //	lightweight control at the virtual client point that supports mouse wheel
                //	events.  This will find the innermost lightweight control, at the top of the
                //	Z order that contains the virual client point and supports mouse wheel events.
                if (BehaviorControl.Visible && BehaviorControl.VirtualBounds.Contains(point))
                {
                    //	Translate the virtual point to be relative to the location of the lightweight control.
                    point.Offset(BehaviorControl.VirtualLocation.X * -1, BehaviorControl.VirtualLocation.Y * -1);

                    //	Recursively get the lightweight control at the translated point that
                    //	supports mouse wheel events.
                    return(BehaviorControl.GetMouseWheelBehaviorControlAtPoint(point));
                }
            }

            //	The client point is not inside any lightweight control that allows mouse wheel
            //	events.
            return(null);
        }
Exemple #2
0
        /// <summary>
        /// Gets the Behavior control that is located at the specified point and allows mouse wheel events.
        /// </summary>
        /// <param name="point">A Point that contains the coordinates where you want to look for a control.
        ///	Coordinates are expressed relative to the upper-left corner of the control's client area.</param>
        /// <returns>Behavior control at the specified point.</returns>
        internal BehaviorControl GetMouseWheelBehaviorControlAtPoint(Point point)
        {
            //	Enumerate the Behavior controls, in Z order, to locate one at the virtual point.
            for (int index = Controls.Count - 1; index >= 0; index--)
            {
                //	Access the Behavior control.
                BehaviorControl BehaviorControl = Controls[index];

                //	If the Behavior control is visible, and the point is within its virtual
                //	bounds, then recursively call it sit is under the point.
                if (BehaviorControl.Visible && BehaviorControl.VirtualBounds.Contains(point))
                {
                    //	Translate the point to be relative to the location of the Behavior control.
                    point.Offset(BehaviorControl.VirtualLocation.X * -1, BehaviorControl.VirtualLocation.Y * -1);

                    //	Recursively search for the right mouse wheel Behavior control.
                    BehaviorControl childMouseWheelBehaviorControl = BehaviorControl.GetMouseWheelBehaviorControlAtPoint(point);
                    if (childMouseWheelBehaviorControl != null)
                    {
                        return(childMouseWheelBehaviorControl);
                    }
                }
            }

            //	The point is not inside a child Behavior control of this Behavior control
            //	that allows mouse wheel events.  So it's inside this Behavior control.  If this
            //	Behavior control allows mouse wheel events, return it.  Otherwise, return null.
            return(AllowMouseWheel ? this : null);
        }