Exemplo n.º 1
0
        /// <summary>
        /// Should a mouse down at the provided point cause an end to popup tracking.
        /// </summary>
        /// <param name="m">Original message.</param>
        /// <param name="pt">Client coordinates point.</param>
        /// <returns>True to end tracking; otherwise false.</returns>
        public virtual bool DoesCurrentMouseDownEndAllTracking(Message m, Point pt)
        {
            bool endTracking = !ClientRectangle.Contains(pt);

            // The mouse is not over our client area but the focus is
            if (endTracking && ContainsFocus)
            {
                // Get the window handle of the window under this screen point
                Point    screenPt   = PointToScreen(pt);
                PI.POINT screenPIPt = new PI.POINT();
                screenPIPt.x = screenPt.X;
                screenPIPt.y = screenPt.Y;
                IntPtr hWnd = PI.WindowFromPoint(screenPIPt);

                // Assuming we got back a valid window handle
                if (hWnd != IntPtr.Zero)
                {
                    StringBuilder className = new StringBuilder(256);
                    int           length    = PI.GetClassName(hWnd, className, className.Capacity);

                    // If we got back a valid name
                    if (length > 0)
                    {
                        // If let the message occur as it is being pressed on a combo box
                        // drop down list and so it will process the message appropriately
                        if (className.ToString() == "ComboLBox")
                        {
                            endTracking = false;
                        }
                    }
                }
            }

            return(endTracking);
        }
        private bool ProcessMouseMoveWithCMS(ref Message m)
        {
            if (_current == null)
            {
                return(false);
            }

            // Convert the client position to screen point
            Point screenPt = CommonHelper.ClientMouseMessageToScreenPt(m);

            // Convert from a class to a structure
            PI.POINT screenPIPt = new PI.POINT();
            screenPIPt.x = screenPt.X;
            screenPIPt.y = screenPt.Y;

            // Get the window handle of the window under this screen point
            IntPtr hWnd = PI.WindowFromPoint(screenPIPt);

            // Is the window handle that of the currently tracking popup
            if (_current.Handle == hWnd)
            {
                return(true);
            }

            // Search all the stacked popups for any that match the window handle
            VisualPopup[] popups = _stack.ToArray();
            for (int i = 0; i < popups.Length; i++)
            {
                if (!popups[i].IsDisposed)
                {
                    if (popups[i].Handle == hWnd)
                    {
                        return(true);
                    }
                }
            }

            // Mouse move is not over a popup, so allow it
            return(false);
        }
Exemplo n.º 3
0
 internal static extern IntPtr WindowFromPoint(PI.POINT pt);