Esempio n. 1
0
        /// <summary>
        /// get glyhs of the designer
        /// </summary>
        /// <param name="selectionType"></param>
        /// <returns></returns>
        public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
        {
            GlyphCollection glyphs = new GlyphCollection();

            // when the split container is not readonly, add the glyphs
            if (!this.spc.IsReadOnly)
            {
                Point     location            = base.BehaviorService.MapAdornerWindowPoint(this.spc.Handle, this.spc.DisplayRectangle.Location);
                Rectangle clientAreaRectangle = new Rectangle(location, this.spc.DisplayRectangle.Size);
                for (int i = 0; i < spc.Panels.Count - 1; i++)
                {
                    Control            item       = spc.GetChildByIndex(i);
                    PropertyDescriptor descriptor = TypeDescriptor.GetProperties(item.Controls[0])["Locked"];
                    bool isLocked = (descriptor != null) ? ((bool)descriptor.GetValue(item.Controls[0])) : false;
                    if (!isLocked && item.Visible) // show glyphs when form inside panel is not locked
                    {
                        Behavior b = new SplitterResizeBehavior(spc, base.Component.Site, item);

                        if (spc.Orientation == Orientation.Horizontal)
                        {
                            glyphs.Add(GetVerticalResizeGlyph(clientAreaRectangle, item.Bounds.Bottom, b));
                        }
                        else
                        {
                            glyphs.Add(GetHorizontalResizeGlyph(clientAreaRectangle, item.Bounds.Right, b));
                        }
                    }
                }
            }
            return(glyphs);
        }
        public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
        {
            GlyphCollection glyphs = base.GetGlyphs(selectionType);

            if (spc.Orientation == Orientation.Horizontal)
            {
                Point                location             = base.BehaviorService.MapAdornerWindowPoint(this.spc.Handle, this.spc.DisplayRectangle.Location);
                Rectangle            clientAreaRectangle  = new Rectangle(location, this.spc.DisplayRectangle.Size);
                int                  thinkness            = 2;
                IOFormSplitContainer iOFormSplitContainer = spc as IOFormSplitContainer;

                if (!iOFormSplitContainer.IsReadOnly) // Show glyphs only when control is not readonly
                {
                    // add glyph to change width of the container
                    Behavior    widthResizeBehavior = new IOFormWidthResizeBehavior(spc as IOFormSplitContainer, base.Component.Site);
                    Rectangle   WEGlyphRect         = new Rectangle(clientAreaRectangle.Left + clientAreaRectangle.Width - thinkness / 2, clientAreaRectangle.Top, thinkness, clientAreaRectangle.Height);
                    ResizeGlyph WEGlyph             = new ResizeGlyph(WEGlyphRect, Cursors.SizeWE, widthResizeBehavior);
                    glyphs.Add(WEGlyph);
                }

                // Add the glyph to change the height of last form when it is visible
                if (spc.Panels.Count > 0 && spc.Panels.Last().Visible)
                {
                    PropertyDescriptor descriptor = TypeDescriptor.GetProperties(spc.Panels.Last().Controls[0])["Locked"];
                    bool isLocked = descriptor != null? (bool)descriptor.GetValue(spc.Panels.Last().Controls[0]) : false;

                    if (!isLocked) // Show glyphs when panel is not locked
                    {
                        SplitterResizeBehavior heightResizeBehavior = new SplitterResizeBehavior(iOFormSplitContainer, base.Component.Site, spc.Panels.Last());
                        Rectangle   NSGlyphRect = new Rectangle(clientAreaRectangle.Left, clientAreaRectangle.Bottom - thinkness, clientAreaRectangle.Width, thinkness);
                        ResizeGlyph NSGlyph     = new ResizeGlyph(NSGlyphRect, Cursors.SizeNS, heightResizeBehavior);
                        glyphs.Add(NSGlyph);
                    }
                }
            }

            return(glyphs);
        }