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);
        }
Esempio n. 2
0
 public void GetGlyphs(ref GlyphCollection glyphs, System.Windows.Forms.Design.Behavior.Behavior standardBehavior)
 {
     if (this.ImmediateParent != null)
     {
         Rectangle glyphBounds = this.GetGlyphBounds();
         ToolStripDesignerUtils.GetAdjustedBounds(this.ToolStripItem, ref glyphBounds);
         BehaviorService service = (BehaviorService)this.GetService(typeof(BehaviorService));
         if (service.ControlRectInAdornerWindow((Control)this.ImmediateParent).Contains(glyphBounds.Left, glyphBounds.Top))
         {
             if (this.ToolStripItem.IsOnDropDown)
             {
                 ToolStrip currentParent = this.ToolStripItem.GetCurrentParent();
                 if (currentParent == null)
                 {
                     currentParent = this.ToolStripItem.Owner;
                 }
                 if ((currentParent != null) && currentParent.Visible)
                 {
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Top, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Left, standardBehavior, true));
                     glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Right, standardBehavior, true));
                 }
             }
             else
             {
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Top, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Left, standardBehavior, true));
                 glyphs.Add(new MiniLockedBorderGlyph(glyphBounds, SelectionBorderGlyphType.Right, standardBehavior, true));
             }
         }
     }
 }
Esempio n. 3
0
        //<summary>
        //get glyhs of the designer
        //</summary>
        //<param name="selectionType"></param>
        //<returns></returns>
        public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
        {
            GlyphCollection    glyphs     = base.GetGlyphs(selectionType);
            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(base.Component)["Locked"];
            bool isLocked = (descriptor != null) ? ((bool)descriptor.GetValue(base.Component)) : false;

            if (selectionType != GlyphSelectionType.NotSelected && !isLocked && !tableControl.IsDragging) //selectionType == GlyphSelectionType.SelectedPrimary
            {
                Point     location            = base.BehaviorService.MapAdornerWindowPoint(this.tableControl.Handle, this.tableControl.DisplayRectangle.Location);
                Rectangle clientAreaRectangle = new Rectangle(location, this.tableControl.DisplayRectangle.Size);
                glyphs.Add(GetVerticalResizeGlyph(clientAreaRectangle, tableControl.TitleHeight + tableControl.RowHeight, RowHeightResizeBehavior));
                glyphs.Add(GetVerticalResizeGlyph(clientAreaRectangle, tableControl.TitleHeight, TitleHeightResizeBehavior));
            }
            return(glyphs);
        }
        internal GlyphCollection GetGlyphs(ToolStrip parent, GlyphCollection glyphs, System.Windows.Forms.Design.Behavior.Behavior standardBehavior)
        {
            if (this.b == null)
            {
                this.b = (BehaviorService)parent.Site.GetService(typeof(BehaviorService));
            }
            Point     pos    = this.b.ControlToAdornerWindow(base.Parent);
            Rectangle bounds = this.Bounds;

            bounds.Offset(pos);
            bounds.Inflate(-2, -2);
            glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Top, standardBehavior, true));
            glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Bottom, standardBehavior, true));
            glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Left, standardBehavior, true));
            glyphs.Add(new MiniLockedBorderGlyph(bounds, SelectionBorderGlyphType.Right, standardBehavior, true));
            return(glyphs);
        }
Esempio n. 5
0
        //protected override bool GetHitTest(Point pt)
        //{
        //    TreeView tree = this.Control as TreeView;
        //    if(tree.ClientRectangle.Contains(tree.PointToClient(pt)))
        //    {
        //        return true;
        //    }
        //    return false;
        //}
        //protected override void WndProc(ref Message m)
        //{
        //    if (m.Msg == (int)WinApi.Messages.WM_VSCROLL)
        //    {
        //        JwDialog.AlertInfo($"MESSAGe;{m.Msg} {m.WParam} {m.LParam}");
        //    }
        //    base.WndProc(ref m);
        //}
        public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType)
        {
            GlyphCollection glyphs = base.GetGlyphs(selectionType);

            if (SelectionService != null)
            {
                if (SelectionService.PrimarySelection == this.Control)
                {
                    glyphs.Add(new EventGlyph(this.BehaviorService, this.Control));
                }
            }
            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);
        }