/// <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); IntPtr hWnd = PI.WindowFromPoint(new PI.POINT(screenPt)); // Assuming we got back a valid window handle if (hWnd != IntPtr.Zero) { string className = PI.GetClassName(hWnd); if (!string.IsNullOrEmpty(className)) { // 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 == "ComboLBox") { endTracking = false; } } } } return(endTracking); }
/// <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); }