Esempio n. 1
0
        public VirtualMaximized RemoveMaximizedRegion(bool removeNow)
        {
            var m = -1;
            VirtualMaximized v = null;

            foreach (VirtualMaximized c in GetComponents(new[] { ComponentType.Maximized }))
            {
                if (c.Id > m)
                {
                    m = c.Id;
                    v = c;
                }
            }

            if (removeNow && m > 0)
            {
                _components.Remove(v);
                return(null);
            }

            return(v);
        }
Esempio n. 2
0
        internal VirtualMaximized AddMaximizedRegion(Rectangle bounds)
        {
            var last = RemoveMaximizedRegion(false);

            if (last == null)
            {
                return(null);
            }

            var offset = new Point(0, last.Id == 0 ? 0 : bounds.Height - last.Rectangle.Bottom > 0 ? last.Rectangle.Height : 0);
            var v      = new VirtualMaximized
            {
                Rectangle = new Rectangle(new Point(last.Rectangle.Location.X + offset.X,
                                                    last.Rectangle.Location.Y + offset.Y), last.Rectangle.Size),
                Id = last.Id + 1,
                RelativeLocation = offset
            };

            _components.InsertAfter(last, v);
            RecalculateLayouts(bounds);

            return(v);
        }