Esempio n. 1
0
        /// <summary>
        /// Show the window relative to provided screen rectangle.
        /// </summary>
        /// <param name="screenRect">Screen rectangle.</param>
        public void ShowRelative(Rectangle screenRect)
        {
            // Find screen middle points
            int yMid = screenRect.Y + (screenRect.Height / 2);
            int xMid = screenRect.X + (screenRect.Width / 2);

            // Find docking size middle points
            int yHalf = _dragData.DockWindowSize.Height / 2;
            int xHalf = _dragData.DockWindowSize.Width / 2;

            if (_dragData.ShowLeft && !_dragData.ShowRight && !_dragData.ShowMiddle && !_dragData.ShowTop && !_dragData.ShowBottom)
            {
                Location = new Point(screenRect.Left + 10, yMid - yHalf);
            }
            else if (!_dragData.ShowLeft && _dragData.ShowRight && !_dragData.ShowMiddle && !_dragData.ShowTop && !_dragData.ShowBottom)
            {
                Location = new Point(screenRect.Right - _dragData.DockWindowSize.Width - 10, yMid - yHalf);
            }
            else if (!_dragData.ShowLeft && !_dragData.ShowRight && !_dragData.ShowMiddle && _dragData.ShowTop && !_dragData.ShowBottom)
            {
                Location = new Point(xMid - xHalf, screenRect.Top + 10);
            }
            else if (!_dragData.ShowLeft && !_dragData.ShowRight && !_dragData.ShowMiddle && !_dragData.ShowTop && _dragData.ShowBottom)
            {
                Location = new Point(xMid - xHalf, screenRect.Bottom - _dragData.DockWindowSize.Height - 10);
            }
            else
            {
                Location = new Point(xMid - xHalf, yMid - yHalf);
            }

            // Show the window without activating it (i.e. do not take focus)
            PI.ShowWindow(this.Handle, (short)PI.SW_SHOWNOACTIVATE);
        }
 /// <summary>
 /// Show the window without taking activation.
 /// </summary>
 public void ShowWithoutActivate()
 {
     // Show the window without activating it (i.e. do not take focus)
     PI.ShowWindow(this.Handle, (short)PI.SW_SHOWNOACTIVATE);
 }
 /// <summary>
 /// Hide the window from display.
 /// </summary>
 public void Hide()
 {
     PI.ShowWindow(this.Handle, (short)PI.SW_HIDE);
 }