Exemplo n.º 1
0
        /// <summary>
        /// add glyph for vertical resize action
        /// </summary>
        /// <param name="glyphs"></param>
        /// <param name="clientAreaRectangle"></param>
        /// <param name="height"></param>
        /// <param name="behavior"></param>
        private ResizeGlyph GetVerticalResizeGlyph(Rectangle clientAreaRectangle, int height, Behavior behavior)
        {
            Rectangle   glyphRectangle = new Rectangle(clientAreaRectangle.Left, clientAreaRectangle.Top + height - RESIZE_GLYPH_SIZE / 2, clientAreaRectangle.Width, RESIZE_GLYPH_SIZE);
            ResizeGlyph glyph          = new ResizeGlyph(glyphRectangle, Cursors.HSplit, behavior);

            return(glyph);
        }
Exemplo n.º 2
0
        /// <summary>
        /// add glyph for horizontal resize action
        /// </summary>
        /// <param name="glyphs"></param>
        /// <param name="clientAreaRectangle"></param>
        /// <param name="height"></param>
        /// <param name="behavior"></param>
        private ResizeGlyph GetHorizontalResizeGlyph(Rectangle clientAreaRectangle, int width, Behavior behavior)
        {
            int         thinkness      = spc.SplitterThinkness + 2;
            Rectangle   glyphRectangle = new Rectangle(clientAreaRectangle.Left + width - thinkness / 2, clientAreaRectangle.Top, thinkness, clientAreaRectangle.Height);
            ResizeGlyph glyph          = new ResizeGlyph(glyphRectangle, Cursors.VSplit, behavior);

            return(glyph);
        }
Exemplo n.º 3
0
        /// <summary>
        /// add glyph for vertical resize action
        /// </summary>
        /// <param name="glyphs"></param>
        /// <param name="clientAreaRectangle"></param>
        /// <param name="height"></param>
        /// <param name="behavior"></param>
        private ResizeGlyph GetVerticalResizeGlyph(Rectangle clientAreaRectangle, int height, Behavior behavior)
        {
            int   thinkness       = spc.SplitterThinkness + 2;
            Point controlLocation = new Point(clientAreaRectangle.Left, clientAreaRectangle.Top + height);

            // get the rect of control
            Rectangle controlRect = new Rectangle(clientAreaRectangle.Left, clientAreaRectangle.Top + height, clientAreaRectangle.Width, thinkness);

            // get glyph rect using offset
            Point     splitterOffset    = spc.GetSplitterOffset();
            Rectangle rectangleForGylph = new Rectangle(controlRect.Left + splitterOffset.X,
                                                        controlRect.Top + splitterOffset.Y,
                                                        controlRect.Width - splitterOffset.X,
                                                        controlRect.Height - splitterOffset.Y);

            ResizeGlyph glyph = new ResizeGlyph(rectangleForGylph, controlRect, Cursors.HSplit, behavior);

            return(glyph);
        }
Exemplo n.º 4
0
        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);
        }