public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc) { ToolStripPanelSelectionGlyph glyph = g as ToolStripPanelSelectionGlyph; if ((button == MouseButtons.Left) && (glyph != null)) { if (!glyph.IsExpanded) { this.ExpandPanel(true); Rectangle bounds = glyph.Bounds; glyph.IsExpanded = true; this.behaviorService.Invalidate(bounds); this.behaviorService.Invalidate(glyph.Bounds); } else { this.relatedControl.Padding = new Padding(0); Rectangle rect = glyph.Bounds; glyph.IsExpanded = false; this.behaviorService.Invalidate(rect); this.behaviorService.Invalidate(glyph.Bounds); ISelectionService service = (ISelectionService)this.serviceProvider.GetService(typeof(ISelectionService)); Component primarySelection = service.PrimarySelection as Component; if (primarySelection != this.relatedControl.Parent) { if (service != null) { service.SetSelectedComponents(new object[] { this.relatedControl.Parent }, SelectionTypes.Replace); } } else { Control parent = this.relatedControl.Parent; parent.PerformLayout(); ((SelectionManager)this.serviceProvider.GetService(typeof(SelectionManager))).Refresh(); Point location = this.behaviorService.ControlToAdornerWindow(parent); Rectangle rectangle3 = new Rectangle(location, parent.Size); this.behaviorService.Invalidate(rectangle3); } } } return(false); }
public override void OnDragDrop(Glyph g, DragEventArgs e) { ToolStripPanelSelectionGlyph glyph = g as ToolStripPanelSelectionGlyph; bool flag = false; ArrayList controls = null; DropSourceBehavior.BehaviorDataObject data = e.Data as DropSourceBehavior.BehaviorDataObject; if (data == null) { if ((e.Data is DataObject) && (controls == null)) { IToolboxService service = (IToolboxService)this.serviceProvider.GetService(typeof(IToolboxService)); IDesignerHost host = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost; if ((service != null) && (host != null)) { ToolboxItem tool = service.DeserializeToolboxItem(e.Data, host); if (((tool.GetType(host) == typeof(ToolStrip)) || (tool.GetType(host) == typeof(MenuStrip))) || (tool.GetType(host) == typeof(StatusStrip))) { ToolStripPanelDesigner designer = host.GetDesigner(this.relatedControl) as ToolStripPanelDesigner; if (designer != null) { OleDragDropHandler oleDragHandler = designer.GetOleDragHandler(); if (oleDragHandler != null) { oleDragHandler.CreateTool(tool, this.relatedControl, 0, 0, 0, 0, false, false); } } } } } } else { controls = new ArrayList(data.DragComponents); foreach (Component component in controls) { ToolStrip strip = component as ToolStrip; if ((strip != null) && (strip.Parent != this.relatedControl)) { flag = true; break; } } if (flag) { Control parent = this.relatedControl.Parent; if (parent != null) { try { parent.SuspendLayout(); this.ExpandPanel(false); Rectangle bounds = glyph.Bounds; glyph.IsExpanded = true; this.behaviorService.Invalidate(bounds); this.behaviorService.Invalidate(glyph.Bounds); this.ReParentControls(controls, e.Effect == DragDropEffects.Copy); } finally { parent.ResumeLayout(true); } } } data.CleanupDrag(); } }
internal Glyph GetGlyph() { if (this.panel != null) { if (this.containerSelectorGlyph == null) { this.behavior = new ToolStripPanelSelectionBehavior(this.panel, base.Component.Site); this.containerSelectorGlyph = new ToolStripPanelSelectionGlyph(Rectangle.Empty, Cursors.Default, this.panel, base.Component.Site, this.behavior); } if (this.panel.Visible) { return this.containerSelectorGlyph; } } return null; }
internal void ExpandTopPanel() { if (this.containerSelectorGlyph == null) { this.behavior = new ToolStripPanelSelectionBehavior(this.panel, base.Component.Site); this.containerSelectorGlyph = new ToolStripPanelSelectionGlyph(Rectangle.Empty, Cursors.Default, this.panel, base.Component.Site, this.behavior); } if ((this.panel != null) && (this.panel.Dock == DockStyle.Top)) { this.panel.Padding = new System.Windows.Forms.Padding(0, 0, 0x19, 0x19); this.containerSelectorGlyph.IsExpanded = true; } }