/// <summary>
        /// Show the popup using the provided rectangle as the screen rect.
        /// </summary>
        /// <param name="screenRect">Screen rectangle for showing the popup.</param>
        public virtual void Show(Rectangle screenRect)
        {
            // Offset by the width/height of the shadow
            screenRect.X += SHADOW_SIZE;
            screenRect.Y += SHADOW_SIZE;

            // Update the screen position
            Location   = screenRect.Location;
            ClientSize = screenRect.Size;

            // Show the window without activating it (i.e. do not take focus)
            PI.ShowWindow(this.Handle, (short)PI.SW_SHOWNOACTIVATE);
            PI.SetWindowPos(this.Handle, (IntPtr)(-2), screenRect.X, screenRect.Y, screenRect.Width, screenRect.Height, 0x0010);
            PI.SetWindowPos(this.Handle, (IntPtr)(-1), screenRect.X, screenRect.Y, screenRect.Width, screenRect.Height, 0x0010);
            //  this.Visible = true;
            //  PI.SetWindowPos(this.Handle, (IntPtr)(-2), screenRect.X, screenRect.Y, screenRect.Width, screenRect.Height, 0x0010);
            //this.TopMost = true;
            //this.TopMost = false;
        }
Example #2
0
        /// <summary>
        /// Show the popup using the provided rectangle as the screen rect.
        /// </summary>
        /// <param name="screenRect">Screen rectangle for showing the popup.</param>
        public virtual void Show(Rectangle screenRect)
        {
            // Update the screen position
            SetBounds(screenRect.X, screenRect.Y,
                      screenRect.Width, screenRect.Height);

            // If we have a shadow then update it now
            if (_shadow != null)
            {
                _shadow.Show(screenRect);
            }

            // Show the window without activating it (i.e. do not take focus)
            PI.ShowWindow(this.Handle, (short)PI.SW_SHOWNOACTIVATE);
            PI.SetWindowPos(this.Handle, (IntPtr)(-1), screenRect.X, screenRect.Y, screenRect.Width, screenRect.Height, 0x0010);
            this.Visible = true;
            // PI.SetWindowPos(this.Handle, (IntPtr)(-2), screenRect.X, screenRect.Y, screenRect.Width, screenRect.Height, 0x0010);
            //this.BringToFront();
            //this.SetTopLevel(true);

            // Use manager to track mouse/keyboard input and to dismiss the window
            VisualPopupManager.Singleton.StartTracking(this);
        }