private bool CheckAssociatedControl(Component c, Glyph childGlyph, GlyphCollection glyphs) { bool flag = false; ToolStripDropDownItem dropDownItem = c as ToolStripDropDownItem; if (dropDownItem != null) { flag = this.CheckDropDownBounds(dropDownItem, childGlyph, glyphs); } if (flag) { return flag; } Control associatedControl = this.GetAssociatedControl(c); if (((associatedControl == null) || (associatedControl == this.toolStripContainer)) || System.Design.UnsafeNativeMethods.IsChild(new HandleRef(this.toolStripContainer, this.toolStripContainer.Handle), new HandleRef(associatedControl, associatedControl.Handle))) { return flag; } Rectangle bounds = childGlyph.Bounds; Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(associatedControl); if ((c == this.designerHost.RootComponent) || !bounds.IntersectsWith(rect)) { glyphs.Insert(0, childGlyph); } return true; }
public virtual GlyphCollection GetGlyphs(GlyphSelectionType selectionType) { GlyphCollection glyphs = new GlyphCollection(); if (selectionType != GlyphSelectionType.NotSelected) { Rectangle controlBounds = this.BehaviorService.ControlRectInAdornerWindow(this.Control); bool primarySelection = selectionType == GlyphSelectionType.SelectedPrimary; System.Windows.Forms.Design.SelectionRules selectionRules = this.SelectionRules; if (this.Locked || (this.InheritanceAttribute == System.ComponentModel.InheritanceAttribute.InheritedReadOnly)) { glyphs.Add(new LockedHandleGlyph(controlBounds, primarySelection)); glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Top)); glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Bottom)); glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Left)); glyphs.Add(new LockedBorderGlyph(controlBounds, SelectionBorderGlyphType.Right)); return glyphs; } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.AllSizeable) == System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new NoResizeHandleGlyph(controlBounds, selectionRules, primarySelection, this.MoveBehavior)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, this.MoveBehavior)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.MoveBehavior)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, this.MoveBehavior)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.MoveBehavior)); if (TypeDescriptor.GetAttributes(base.Component).Contains(DesignTimeVisibleAttribute.Yes) && (this.behaviorService.DesignerActionUI != null)) { Glyph designerActionGlyph = this.behaviorService.DesignerActionUI.GetDesignerActionGlyph(base.Component); if (designerActionGlyph != null) { glyphs.Insert(0, designerActionGlyph); } } return glyphs; } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.TopSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleTop, this.StandardBehavior, primarySelection)); if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.UpperLeft, this.StandardBehavior, primarySelection)); } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.UpperRight, this.StandardBehavior, primarySelection)); } } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.BottomSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleBottom, this.StandardBehavior, primarySelection)); if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerLeft, this.StandardBehavior, primarySelection)); } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerRight, this.StandardBehavior, primarySelection)); } } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.LeftSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleLeft, this.StandardBehavior, primarySelection)); } if ((selectionRules & System.Windows.Forms.Design.SelectionRules.RightSizeable) != System.Windows.Forms.Design.SelectionRules.None) { glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleRight, this.StandardBehavior, primarySelection)); } glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, this.StandardBehavior)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.StandardBehavior)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, this.StandardBehavior)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.StandardBehavior)); if (TypeDescriptor.GetAttributes(base.Component).Contains(DesignTimeVisibleAttribute.Yes) && (this.behaviorService.DesignerActionUI != null)) { Glyph glyph2 = this.behaviorService.DesignerActionUI.GetDesignerActionGlyph(base.Component); if (glyph2 != null) { glyphs.Insert(0, glyph2); } } } return glyphs; }
public override GlyphCollection GetGlyphs(GlyphSelectionType selType) { GlyphCollection glyphs = new GlyphCollection(); foreach (object obj2 in this.SelectionService.GetSelectedComponents()) { if (obj2 is System.Windows.Forms.ToolStrip) { GlyphCollection glyphs2 = base.GetGlyphs(selType); glyphs.AddRange(glyphs2); } else { ToolStripItem component = obj2 as ToolStripItem; if ((component != null) && component.Visible) { ToolStripItemDesigner designer = (ToolStripItemDesigner) this.host.GetDesigner(component); if (designer != null) { designer.GetGlyphs(ref glyphs, this.StandardBehavior); } } } } if ((((this.SelectionRules & SelectionRules.Moveable) != SelectionRules.None) && (this.InheritanceAttribute != System.ComponentModel.InheritanceAttribute.InheritedReadOnly)) && (selType != GlyphSelectionType.NotSelected)) { Point location = base.BehaviorService.ControlToAdornerWindow((Control) base.Component); Rectangle containerBounds = new Rectangle(location, ((Control) base.Component).Size); int glyphOffset = (int) (DesignerUtils.CONTAINERGRABHANDLESIZE * 0.5); if (containerBounds.Width < (2 * DesignerUtils.CONTAINERGRABHANDLESIZE)) { glyphOffset = -1 * glyphOffset; } ContainerSelectorBehavior behavior = new ContainerSelectorBehavior(this.ToolStrip, base.Component.Site, true); ContainerSelectorGlyph glyph = new ContainerSelectorGlyph(containerBounds, DesignerUtils.CONTAINERGRABHANDLESIZE, glyphOffset, behavior); glyphs.Insert(0, glyph); } return glyphs; }
private bool CheckDropDownBounds(ToolStripDropDownItem dropDownItem, Glyph childGlyph, GlyphCollection glyphs) { if (dropDownItem == null) { return false; } Rectangle bounds = childGlyph.Bounds; Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(dropDownItem.DropDown); if (!bounds.IntersectsWith(rect)) { glyphs.Insert(0, childGlyph); } return true; }