private void Close(ControlInfo info) { if (info.Client.Close(info.Control)) { ControlHostService.UnregisterControl(info.Control); } }
/// <summary> /// Finishes initializing component by subscribing to event, registering control, and setting up Settings Service</summary> public virtual void Initialize() { ContextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged; ControlHostService.RegisterControl(m_propertyGrid, m_controlInfo, this); if (SettingsService != null) { SettingsService.RegisterSettings(this, new BoundPropertyDescriptor(m_propertyGrid, () => m_propertyGrid.Settings, "Settings", null, null)); } }
/// <summary> /// Finishes initializing component by subscribing to event, registering control, and setting up Settings Service</summary> public virtual void Initialize() { Configure(out m_propertyGrid, out m_controlInfo); // create image for clone button. if (s_cloneImage == null) { s_cloneImage = new Bitmap(16, 16, System.Drawing.Imaging.PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(s_cloneImage)) { g.Clear(Color.Transparent); var rect = new Rectangle(1, 1, 8, 10); g.FillRectangle(Brushes.White, rect); g.DrawRectangle(Pens.Black, rect); rect.Location = new Point(6, 5); g.FillRectangle(Brushes.White, rect); g.DrawRectangle(Pens.Black, rect); } } var cloneButton = new ToolStripButton(); cloneButton.DisplayStyle = ToolStripItemDisplayStyle.Image; cloneButton.Image = s_cloneImage; cloneButton.Name = "cloneButton"; cloneButton.Size = new Size(29, 22); cloneButton.ToolTipText = "Clone this editor".Localize(); cloneButton.Click += (sender, e) => Duplicate(); m_propertyGrid.ToolStrip.Items.Add(cloneButton); m_propertyGrid.PropertyGridView.ContextRegistry = ContextRegistry; m_propertyGrid.MouseUp += propertyGrid_MouseUp; ContextRegistry.ActiveContextChanged += contextRegistry_ActiveContextChanged; ControlHostService.RegisterControl(m_propertyGrid, m_controlInfo, this); if (SettingsService != null) { SettingsService.RegisterSettings(this, new BoundPropertyDescriptor(m_propertyGrid, () => m_propertyGrid.Settings, "Settings", null, null)); var groupDescr = new BoundPropertyDescriptor(this.GetType(), () => ClonedEditorGroup, "Docking", null, "Initial docking group for duplicated property editors\r\nCenter, CenterPermanent, and Hidden are not accepted".Localize()); SettingsService.RegisterSettings(this, groupDescr); SettingsService.RegisterUserSettings("Property Editor".Localize(), groupDescr); } }
public DockContent(ControlHostService controlHostService) { m_controlHostService = controlHostService; }