Ejemplo n.º 1
0
        private static void WindowBottom_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            Window w = sender as Window;

            var size     = System.Windows.Forms.Screen.AllScreens[GetWindowScreen(w)].Bounds.Size;
            var location = System.Windows.Forms.Screen.AllScreens[GetWindowScreen(w)].Bounds.Location;

            Point indent = new Point();

            if (w.Owner != null)
            {
                WindowPosition position = WindowPositionBehaviour.GetWindowPosition(w.Owner);
                switch (WindowPositionBehaviour.GetWindowPosition(w.Owner))
                {
                case WindowPosition.Left:
                case WindowPosition.LeftBottom:
                case WindowPosition.LeftTop:
                    indent.X = w.Owner.Width + (HideButtonBehaviour.GetUseHideButton(w.Owner) ? -30 : 0);
                    break;

                case WindowPosition.Right:
                case WindowPosition.RightBottom:
                case WindowPosition.RightTop:
                    indent.X = -(w.Owner.Width - (HideButtonBehaviour.GetUseHideButton(w.Owner) ? 30 : 0));
                    break;

                case WindowPosition.Top:
                    indent.Y = w.Owner.Height + (HideButtonBehaviour.GetUseHideButton(w.Owner) ? -30 : 0);
                    break;

                case WindowPosition.Bottom:
                    indent.Y = -w.Owner.Height + (HideButtonBehaviour.GetUseHideButton(w.Owner) ? 30 - ((size.Height - NTW.Common.GetIndentTaskBar(true)) - w.Owner.Top - w.Owner.ActualHeight - 6) : 0);
                    break;
                }
            }

            Thickness th = WindowPositionBehaviour.GetWindowThickness(w);

            w.Left = th.Top;
            w.Top  = location.Y + size.Height - e.NewSize.Height - NTW.Common.GetIndentTaskBar(true) - th.Top - th.Bottom + indent.Y;
        }
Ejemplo n.º 2
0
        private static void WindowRight_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            Window w = sender as Window;

            var size     = System.Windows.Forms.Screen.AllScreens[GetWindowScreen(w)].Bounds.Size;
            var location = System.Windows.Forms.Screen.AllScreens[GetWindowScreen(w)].Bounds.Location;

            Point indent = new Point();

            if (w.Owner != null)
            {
                WindowPosition position = WindowPositionBehaviour.GetWindowPosition(w.Owner);
                switch (WindowPositionBehaviour.GetWindowPosition(w.Owner))
                {
                case WindowPosition.Left:
                case WindowPosition.LeftBottom:
                case WindowPosition.LeftTop:
                    indent.X = (HideButtonBehaviour.GetUseHideButton(w.Owner) ? -30 : 0);
                    break;

                case WindowPosition.Right:
                case WindowPosition.RightBottom:
                case WindowPosition.RightTop:
                    indent.X = -(HideButtonBehaviour.GetUseHideButton(w.Owner) ? 30 - (size.Width - w.Owner.Left - w.Owner.ActualWidth - 6) : -(size.Width - w.Owner.Left - w.Owner.ActualWidth - 6));
                    break;

                case WindowPosition.Top:
                    indent.Y = (HideButtonBehaviour.GetUseHideButton(w.Owner) ? -30 : 0);
                    break;

                case WindowPosition.Bottom:
                    indent.Y = (HideButtonBehaviour.GetUseHideButton(w.Owner) ? 30 : 0);
                    break;
                }
            }

            Thickness th = WindowPositionBehaviour.GetWindowThickness(w);

            w.Left = -(w.Owner != null ? w.Owner.Width + indent.X : 0) + location.X + size.Width - e.NewSize.Width - NTW.Common.GetIndentTaskBar(false) - th.Left - th.Right;
            w.Top  = th.Top;
        }