Beispiel #1
0
        protected override ControlBodyGlyph GetControlGlyph(GlyphSelectionType selectionType)
        {
            SelectionManager service = (SelectionManager)this.GetService(typeof(SelectionManager));

            if (service != null)
            {
                for (int i = 0; i <= 4; i++)
                {
                    Control         c        = this.panels[i];
                    Rectangle       bounds   = base.BehaviorService.ControlRectInAdornerWindow(c);
                    ControlDesigner designer = this.InternalControlDesigner(i);
                    this.OnSetCursor();
                    if (designer != null)
                    {
                        ControlBodyGlyph glyph = new ControlBodyGlyph(bounds, Cursor.Current, c, designer);
                        service.BodyGlyphAdorner.Glyphs.Add(glyph);
                        bool        flag = true;
                        ICollection selectedComponents = this.selectionSvc.GetSelectedComponents();
                        if (!this.selectionSvc.GetComponentSelected(this.toolStripContainer))
                        {
                            foreach (object obj2 in selectedComponents)
                            {
                                if (this.ContainerParent(obj2 as Control) == this.toolStripContainer)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    flag = false;
                                }
                            }
                        }
                        if (flag)
                        {
                            ToolStripPanelDesigner designer2 = designer as ToolStripPanelDesigner;
                            if (designer2 != null)
                            {
                                this.AddPanelSelectionGlyph(designer2, service);
                            }
                        }
                    }
                }
            }
            return(base.GetControlGlyph(selectionType));
        }
 private void AddPanelSelectionGlyph(ToolStripPanelDesigner designer, SelectionManager selMgr)
 {
     if (designer != null)
     {
         Glyph childGlyph = designer.GetGlyph();
         if (childGlyph != null)
         {
             foreach (object obj2 in this.selectionSvc.GetSelectedComponents())
             {
                 Component c = obj2 as Component;
                 if ((c != null) && !this.CheckAssociatedControl(c, childGlyph, selMgr.BodyGlyphAdorner.Glyphs))
                 {
                     selMgr.BodyGlyphAdorner.Glyphs.Insert(0, childGlyph);
                 }
             }
         }
     }
 }
Beispiel #3
0
 private void AddPanelSelectionGlyph(ToolStripPanelDesigner designer, SelectionManager selMgr)
 {
     if (designer != null)
     {
         Glyph childGlyph = designer.GetGlyph();
         if (childGlyph != null)
         {
             foreach (object obj2 in this.selectionSvc.GetSelectedComponents())
             {
                 Component c = obj2 as Component;
                 if ((c != null) && !this.CheckAssociatedControl(c, childGlyph, selMgr.BodyGlyphAdorner.Glyphs))
                 {
                     selMgr.BodyGlyphAdorner.Glyphs.Insert(0, childGlyph);
                 }
             }
         }
     }
 }
 private void ChangeProperty(Component comp, string propertyName, object value)
 {
     if (this.host != null)
     {
         ToolStripPanel         panel    = comp as ToolStripPanel;
         ToolStripPanelDesigner designer = this.host.GetDesigner(comp) as ToolStripPanelDesigner;
         if (propertyName.Equals("Visible"))
         {
             foreach (Control control in panel.Controls)
             {
                 PropertyDescriptor descriptor = TypeDescriptor.GetProperties(control)["Visible"];
                 if (descriptor != null)
                 {
                     descriptor.SetValue(control, value);
                 }
             }
             if (!((bool)value))
             {
                 if (panel != null)
                 {
                     panel.Padding = new Padding(0);
                 }
                 if ((designer != null) && (designer.ToolStripPanelSelectorGlyph != null))
                 {
                     designer.ToolStripPanelSelectorGlyph.IsExpanded = false;
                 }
             }
         }
         PropertyDescriptor descriptor2 = TypeDescriptor.GetProperties(comp)[propertyName];
         if (descriptor2 != null)
         {
             descriptor2.SetValue(comp, value);
         }
         SelectionManager service = (SelectionManager)this.provider.GetService(typeof(SelectionManager));
         if (service != null)
         {
             service.Refresh();
         }
         if (designer != null)
         {
             designer.InvalidateGlyph();
         }
     }
 }