public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     base.AutoResizeHandles = true;
     this.host = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (this.host != null)
     {
         this.componentChangeSvc = (IComponentChangeService) this.host.GetService(typeof(IComponentChangeService));
     }
     if (this.undoEngine == null)
     {
         this.undoEngine = this.GetService(typeof(UndoEngine)) as UndoEngine;
         if (this.undoEngine != null)
         {
             this.undoEngine.Undoing += new EventHandler(this.OnUndoing);
             this.undoEngine.Undone += new EventHandler(this.OnUndone);
         }
     }
     this.editManager = new ToolStripEditorManager(component);
     if (this.Control.IsHandleCreated)
     {
         this.InitializeNewItemDropDown();
     }
     else
     {
         this.Control.HandleCreated += new EventHandler(this.Control_HandleCreated);
     }
     if (this.componentChangeSvc != null)
     {
         this.componentChangeSvc.ComponentRemoved += new ComponentEventHandler(this.ComponentChangeSvc_ComponentRemoved);
         this.componentChangeSvc.ComponentRemoving += new ComponentEventHandler(this.ComponentChangeSvc_ComponentRemoving);
         this.componentChangeSvc.ComponentAdded += new ComponentEventHandler(this.ComponentChangeSvc_ComponentAdded);
         this.componentChangeSvc.ComponentAdding += new ComponentEventHandler(this.ComponentChangeSvc_ComponentAdding);
         this.componentChangeSvc.ComponentChanged += new ComponentChangedEventHandler(this.ComponentChangeSvc_ComponentChanged);
     }
     this.toolStripAdornerWindowService = (ToolStripAdornerWindowService) this.GetService(typeof(ToolStripAdornerWindowService));
     this.SelectionService.SelectionChanging += new EventHandler(this.selSvc_SelectionChanging);
     this.SelectionService.SelectionChanged += new EventHandler(this.selSvc_SelectionChanged);
     this.ToolStrip.Resize += new EventHandler(this.ToolStrip_Resize);
     this.ToolStrip.DockChanged += new EventHandler(this.ToolStrip_Resize);
     this.ToolStrip.LayoutCompleted += new EventHandler(this.ToolStrip_LayoutCompleted);
     this.ToolStrip.OverflowButton.DropDown.TopLevel = false;
     if (this.CanAddItems)
     {
         new EditorServiceContext(this, TypeDescriptor.GetProperties(base.Component)["Items"], System.Design.SR.GetString("ToolStripItemCollectionEditorVerb"));
         this.keyboardHandlingService = (ToolStripKeyboardHandlingService) this.GetService(typeof(ToolStripKeyboardHandlingService));
         if (this.keyboardHandlingService == null)
         {
             this.keyboardHandlingService = new ToolStripKeyboardHandlingService(base.Component.Site);
         }
         if (((ISupportInSituService) this.GetService(typeof(ISupportInSituService))) == null)
         {
             ISupportInSituService service = new ToolStripInSituService(base.Component.Site);
         }
     }
     this.toolStripSelected = true;
     if (this.keyboardHandlingService != null)
     {
         this.KeyboardHandlingService.SelectedDesignerControl = null;
     }
 }
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     this.host = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (((ToolStripKeyboardHandlingService) this.GetService(typeof(ToolStripKeyboardHandlingService))) == null)
     {
         ToolStripKeyboardHandlingService service = new ToolStripKeyboardHandlingService(component.Site);
     }
     if (((ISupportInSituService) this.GetService(typeof(ISupportInSituService))) == null)
     {
         ISupportInSituService service2 = new ToolStripInSituService(base.Component.Site);
     }
     this.dropDown = (ToolStripDropDown) base.Component;
     this.dropDown.Visible = false;
     this.AutoClose = this.dropDown.AutoClose;
     this.AllowDrop = this.dropDown.AllowDrop;
     this.selSvc = (ISelectionService) this.GetService(typeof(ISelectionService));
     if (this.selSvc != null)
     {
         if ((this.host != null) && !this.host.Loading)
         {
             this.selSvc.SetSelectedComponents(new IComponent[] { this.host.RootComponent }, SelectionTypes.Replace);
         }
         this.selSvc.SelectionChanging += new EventHandler(this.OnSelectionChanging);
         this.selSvc.SelectionChanged += new EventHandler(this.OnSelectionChanged);
     }
     this.designMenu = new MenuStrip();
     this.designMenu.Visible = false;
     this.designMenu.AutoSize = false;
     this.designMenu.Dock = DockStyle.Top;
     Control rootComponent = this.host.RootComponent as Control;
     if (rootComponent != null)
     {
         this.menuItem = new ToolStripMenuItem();
         this.menuItem.BackColor = SystemColors.Window;
         this.menuItem.Name = base.Component.Site.Name;
         this.menuItem.Text = (this.dropDown != null) ? this.dropDown.GetType().Name : this.menuItem.Name;
         this.designMenu.Items.Add(this.menuItem);
         rootComponent.Controls.Add(this.designMenu);
         this.designMenu.SendToBack();
         this.nestedContainer = this.GetService(typeof(INestedContainer)) as INestedContainer;
         if (this.nestedContainer != null)
         {
             this.nestedContainer.Add(this.menuItem, "ContextMenuStrip");
         }
     }
     new EditorServiceContext(this, TypeDescriptor.GetProperties(base.Component)["Items"], System.Design.SR.GetString("ToolStripItemCollectionEditorVerb"));
     if (this.undoEngine == null)
     {
         this.undoEngine = this.GetService(typeof(UndoEngine)) as UndoEngine;
         if (this.undoEngine != null)
         {
             this.undoEngine.Undone += new EventHandler(this.OnUndone);
         }
     }
 }