ComponentFactory.Krypton.Toolkit.VisualPopup.AllowMouseMove C# (CSharp) Method

AllowMouseMove() public method

Should the mouse move at provided screen point be allowed.
public AllowMouseMove ( Message m, Point pt ) : bool
m System.Windows.Forms.Message Original message.
pt Point Client coordinates point.
return bool
        public virtual bool AllowMouseMove(Message m, Point pt)
        {
            // If we have the focus then we always allow the mouse move
            if (ContainsFocus)
                return true;
            else
            {
                // If the mouse is over this popup then allow
                return RectangleToScreen(ClientRectangle).Contains(pt);
            }
        }

Usage Example

        private bool ProcessMouseMove(ref Message m)
        {
            // Is this message for a different window?
            if (m.HWnd != _current.Handle)
            {
                // Convert the client position to screen point
                Point screenPt = CommonHelper.ClientMouseMessageToScreenPt(m);

                // Ask the current popup if it allows the mouse move
                if (_current.AllowMouseMove(m, screenPt))
                {
                    return(false);
                }

                // Ask each stacked entry if they allow the mouse move
                VisualPopup[] popups = _stack.ToArray();

                // Search from end towards the front, the last entry is the most recent 'Push'
                for (int i = popups.Length - 1; i >= 0; i--)
                {
                    if (!popups[i].IsDisposed)
                    {
                        if (popups[i].AllowMouseMove(m, screenPt))
                        {
                            return(false);
                        }
                    }
                }

                // No popup allows the mouse move, so suppress it
                return(true);
            }
            else
            {
                return(false);
            }
        }