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; }
public override GlyphCollection GetGlyphs(GlyphSelectionType selectionType) { GlyphCollection glyphs = new GlyphCollection(); if (selectionType != GlyphSelectionType.NotSelected) { Point location = base.BehaviorService.ControlToAdornerWindow((Control) base.Component); Rectangle controlBounds = new Rectangle(location, ((Control) base.Component).Size); bool primarySelection = selectionType == GlyphSelectionType.SelectedPrimary; bool flag2 = false; PropertyDescriptor descriptor = TypeDescriptor.GetProperties(base.Component)["Locked"]; if (descriptor != null) { flag2 = (bool) descriptor.GetValue(base.Component); } bool flag3 = false; descriptor = TypeDescriptor.GetProperties(base.Component)["AutoSize"]; if (descriptor != null) { flag3 = (bool) descriptor.GetValue(base.Component); } AutoSizeMode growOnly = AutoSizeMode.GrowOnly; descriptor = TypeDescriptor.GetProperties(base.Component)["AutoSizeMode"]; if (descriptor != null) { growOnly = (AutoSizeMode) descriptor.GetValue(base.Component); } System.Windows.Forms.Design.SelectionRules selectionRules = this.SelectionRules; if (flag2) { 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 ((flag3 && (growOnly == AutoSizeMode.GrowAndShrink)) && !(this.Control is Form)) { glyphs.Add(new NoResizeHandleGlyph(controlBounds, selectionRules, primarySelection, null)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, null)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, null)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, null)); glyphs.Add(new NoResizeSelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, null)); return glyphs; } glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleRight, this.StandardBehavior, primarySelection)); glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.LowerRight, this.StandardBehavior, primarySelection)); glyphs.Add(new GrabHandleGlyph(controlBounds, GrabHandleGlyphType.MiddleBottom, this.StandardBehavior, primarySelection)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Top, null)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Bottom, this.StandardBehavior)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Left, null)); glyphs.Add(new SelectionBorderGlyph(controlBounds, selectionRules, SelectionBorderGlyphType.Right, this.StandardBehavior)); } return glyphs; }
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 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)); } } } }
public GlyphCollection GetGlyphsForComponent(IComponent comp) { GlyphCollection glyphs = new GlyphCollection(); if (((this.behaviorSvc != null) && (comp != null)) && (this.behaviorSvc.DesignerActionUI != null)) { Glyph designerActionGlyph = this.behaviorSvc.DesignerActionUI.GetDesignerActionGlyph(comp); if (designerActionGlyph != null) { glyphs.Add(designerActionGlyph); } } return glyphs; }