private void DropDownItem_DropDownOpened(object sender, EventArgs e) { ToolStripDropDownItem item = sender as ToolStripDropDownItem; if (item != null) { this.ResetGlyphs(item); } Control dropDown = item.DropDown; if (dropDown != null) { ControlDesigner designer = this.designerHost.GetDesigner(this.designerHost.RootComponent) as ControlDesigner; if (designer != null) { this.rootControlGlyph = new ToolStripDropDownGlyph(dropDown.Bounds, new DropDownBehavior(designer, this)); } if (this.toolStripAdornerWindowService != null) { this.toolStripAdornerWindowService.DropDownAdorner.Glyphs.Add(this.rootControlGlyph); } } }
private void DropDownResize(object sender, EventArgs e) { ToolStripDropDown down = sender as ToolStripDropDown; if (!base.dummyItemAdded) { if ((((down != null) && down.Visible) && (this.toolStripAdornerWindowService != null)) && ((down.Width < this.dropDownSizeToInvalidate.Width) || (down.Size.Height < this.dropDownSizeToInvalidate.Height))) { using (Region region = new Region(this.dropDownSizeToInvalidate)) { region.Exclude(down.Bounds); this.toolStripAdornerWindowService.Invalidate(region); BehaviorService service = (BehaviorService) this.GetService(typeof(BehaviorService)); if (service != null) { service.Invalidate(region); } } } if (this.toolStripAdornerWindowService != null) { if ((this.rootControlGlyph != null) && this.toolStripAdornerWindowService.DropDownAdorner.Glyphs.Contains(this.rootControlGlyph)) { this.toolStripAdornerWindowService.DropDownAdorner.Glyphs.Remove(this.rootControlGlyph); } ControlDesigner designer = this.designerHost.GetDesigner(this.designerHost.RootComponent) as ControlDesigner; if (designer != null) { this.rootControlGlyph = new ToolStripDropDownGlyph(down.Bounds, new DropDownBehavior(designer, this)); } this.toolStripAdornerWindowService.DropDownAdorner.Glyphs.Add(this.rootControlGlyph); } } this.dropDownSizeToInvalidate = down.Bounds; }