protected void CheckMouseDown(Control control, Point mousePosition) { Control popup = Popup as Control; IPopupControl pc = Popup; if (pc == null || !popup.Created || !popup.Visible || pc.PopupWindow == null || !pc.PopupWindow.Visible) { return; } Control parent = GetParent(pc.PopupWindow); if (parent.Contains(control) || parent == control || popup == control || popup.Contains(control)) { return; } if (IsPopupMenu(control)) { return; } if (!pc.AllowMouseClick(control, mousePosition)) { pc.ClosePopup(); } }