private void OnSelectionChanged(object sender, EventArgs e)
        {
            ISelectionService service = (ISelectionService)this.GetService(typeof(ISelectionService));

            this.collapsibleContainerSelected = false;
            if (service != null)
            {
                foreach (object obj2 in service.GetSelectedComponents())
                {
                    CollapsibleContainerPanel panel = obj2 as CollapsibleContainerPanel;
                    if ((panel != null) && (panel.Parent == this.collapsibleContainer))
                    {
                        this.collapsibleContainerSelected = false;
                        this.Selected = panel;
                        break;
                    }
                    this.Selected = null;
                    if (obj2 == this.collapsibleContainer)
                    {
                        this.collapsibleContainerSelected = true;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public CollapsibleContainerBase()
        {
            base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            panel1 = new CollapsibleContainerPanel();
            panel2 = new CollapsibleContainerPanel();
            ((TypedControlCollection)Controls).AddInternal(panel1);
            ((TypedControlCollection)Controls).AddInternal(panel2);
            CollapseOrExpand(false);
        }
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            this.collapsibleContainerPanel = (CollapsibleContainerPanel)component;
            this.designerHost = (IDesignerHost)component.Site.GetService(typeof(IDesignerHost));
            this.collapsibleContainerDesigner = (ICollapsibleContainerDesigner)this.designerHost.GetDesigner(this.collapsibleContainerPanel.Parent);
            IComponentChangeService service = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));

            if (service != null)
            {
                service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
            }
            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Locked"];

            if ((descriptor != null) && (this.collapsibleContainerPanel.Parent is CollapsibleContainer))
            {
                descriptor.SetValue(component, true);
            }
        }
Ejemplo n.º 4
0
		public override void Initialize(IComponent component)
		{
			base.Initialize(component);
			base.AutoResizeHandles=true;
			this.collapsibleContainer=component as CollapsibleContainer;
			this.collapsibleContainerPanel=this.collapsibleContainer.Panel;
			base.EnableDesignMode(this.collapsibleContainer.Panel, "Panel");
			this.designerHost=(IDesignerHost)component.Site.GetService(typeof(IDesignerHost));
			if(this.selectedPanel==null)
			{
				this.Selected=this.collapsibleContainerPanel;
			}
			this.collapsibleContainer.MouseDown+=new MouseEventHandler(this.OnCollapsibleContainerClick);
			this.collapsibleContainer.DoubleClick+=new EventHandler(this.OnCollapsibleContainerDoubleClick);
			this.collapsibleContainer.SizeChanged+=new EventHandler(this.OnSizeChanged);
			ISelectionService service=(ISelectionService)this.GetService(typeof(ISelectionService));
			if(service!=null)
			{
				service.SelectionChanged+=new EventHandler(this.OnSelectionChanged);
			}
		}
Ejemplo n.º 5
0
        public CollapsibleContainer()
        {
            base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            panel          = new CollapsibleContainerPanel();
            panel.TabIndex = 2;
            ((TypedControlCollection)Controls).AddInternal(panel);
            CollapseOrExpand(false);

            headerTableLayoutPanel.SuspendLayout();

            headerTableLayoutPanel.ColumnCount = 2;
            headerTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            headerTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 26F));
            headerTableLayoutPanel.Controls.Add(headerLabel, 0, 0);
            headerTableLayoutPanel.Controls.Add(headerCheckbox, 0, 0);
            headerTableLayoutPanel.Controls.Add(headerImage, 1, 0);
            headerTableLayoutPanel.Dock     = DockStyle.Top;
            headerTableLayoutPanel.Location = new Point(0, 0);
            headerTableLayoutPanel.Height   = HeaderHeight;
            headerTableLayoutPanel.Name     = "headerTableLayoutPanel";
            headerTableLayoutPanel.RowCount = 1;
            headerTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            headerTableLayoutPanel.TabIndex = 0;

            // Header Label
            headerLabel.Dock      = DockStyle.Fill;
            headerLabel.Text      = "Header Text";
            headerLabel.AutoSize  = false;
            headerLabel.TextAlign = ContentAlignment.MiddleLeft;
            headerLabel.TabIndex  = 0;
            headerLabel.Click    += delegate(object s, EventArgs e) { Collapsed = !Collapsed; };

            // Header Checkbox
            headerCheckbox.Dock      = DockStyle.Fill;
            headerCheckbox.Text      = "Header Text";
            headerCheckbox.Name      = "headerCheckbox";
            headerCheckbox.Padding   = new Padding(2, 2, 0, 0);
            headerCheckbox.TextAlign = ContentAlignment.BottomLeft;
            headerCheckbox.TabIndex  = 1;
            headerCheckbox.UseVisualStyleBackColor = true;
            headerCheckbox.CheckedChanged         += delegate { panel.Enabled = headerCheckbox.Checked; if (headerCheckbox.Checked)
                                                                {
                                                                    Collapsed = false;
                                                                }
            };
            headerCheckbox.Visible = false;

            // Image
            headerImage.Dock = DockStyle.Fill;
            headerImage.FlatAppearance.BorderSize = 0;
            headerImage.FlatStyle  = System.Windows.Forms.FlatStyle.Flat;
            headerImage.Image      = Free.Controls.Properties.Resources.Collapse;
            headerImage.Name       = "headerImage";
            headerImage.ImageAlign = ContentAlignment.TopLeft;
            headerImage.Margin     = new Padding(0);
            headerImage.TabIndex   = 0;
            headerImage.UseVisualStyleBackColor = true;
            headerImage.Click += delegate(object s, EventArgs e) { Collapsed = !Collapsed; };

            headerTableLayoutPanel.ResumeLayout(false);

            ((TypedControlCollection)Controls).AddInternal(headerTableLayoutPanel);
        }
		public CollapsibleContainerBase()
		{
			base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

			panel1=new CollapsibleContainerPanel();
			panel2=new CollapsibleContainerPanel();
			((TypedControlCollection)Controls).AddInternal(panel1);
			((TypedControlCollection)Controls).AddInternal(panel2);
			CollapseOrExpand(false);
		}
		public CollapsibleContainer()
		{
			base.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

			panel=new CollapsibleContainerPanel();
			panel.TabIndex=2;
			((TypedControlCollection)Controls).AddInternal(panel);
			CollapseOrExpand(false);

			headerTableLayoutPanel.SuspendLayout();

			headerTableLayoutPanel.ColumnCount=2;
			headerTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
			headerTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 26F));
			headerTableLayoutPanel.Controls.Add(headerLabel, 0, 0);
			headerTableLayoutPanel.Controls.Add(headerCheckbox, 0, 0);
			headerTableLayoutPanel.Controls.Add(headerImage, 1, 0);
			headerTableLayoutPanel.Dock=DockStyle.Top;
			headerTableLayoutPanel.Location=new Point(0, 0);
			headerTableLayoutPanel.Height=HeaderHeight;
			headerTableLayoutPanel.Name="headerTableLayoutPanel";
			headerTableLayoutPanel.RowCount=1;
			headerTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
			headerTableLayoutPanel.TabIndex=0;

			// Header Label
			headerLabel.Dock=DockStyle.Fill;
			headerLabel.Text="Header Text";
			headerLabel.AutoSize=false;
			headerLabel.TextAlign=ContentAlignment.MiddleLeft;
			headerLabel.TabIndex=0;
			headerLabel.Click+=delegate(object s, EventArgs e) { Collapsed=!Collapsed; };

			// Header Checkbox
			headerCheckbox.Dock=DockStyle.Fill;
			headerCheckbox.Text="Header Text";
			headerCheckbox.Name="headerCheckbox";
			headerCheckbox.Padding=new Padding(2, 2, 0, 0);
			headerCheckbox.TextAlign=ContentAlignment.BottomLeft;
			headerCheckbox.TabIndex=1;
			headerCheckbox.UseVisualStyleBackColor=true;
			headerCheckbox.CheckedChanged+=delegate { panel.Enabled=headerCheckbox.Checked; if(headerCheckbox.Checked) Collapsed=false; };
			headerCheckbox.Visible=false;

			// Image
			headerImage.Dock=DockStyle.Fill;
			headerImage.FlatAppearance.BorderSize=0;
			headerImage.FlatStyle=System.Windows.Forms.FlatStyle.Flat;
			headerImage.Image=Free.Controls.Properties.Resources.Collapse;
			headerImage.Name="headerImage";
			headerImage.ImageAlign=ContentAlignment.TopLeft;
			headerImage.Margin=new Padding(0);
			headerImage.TabIndex=0;
			headerImage.UseVisualStyleBackColor=true;
			headerImage.Click+=delegate(object s, EventArgs e) { Collapsed=!Collapsed; };

			headerTableLayoutPanel.ResumeLayout(false);

			((TypedControlCollection)Controls).AddInternal(headerTableLayoutPanel);
		}
		public override void Initialize(IComponent component)
		{
			base.Initialize(component);
			this.collapsibleContainerPanel=(CollapsibleContainerPanel)component;
			this.designerHost=(IDesignerHost)component.Site.GetService(typeof(IDesignerHost));
			this.collapsibleContainerDesigner=(ICollapsibleContainerDesigner)this.designerHost.GetDesigner(this.collapsibleContainerPanel.Parent);
			IComponentChangeService service=(IComponentChangeService)this.GetService(typeof(IComponentChangeService));
			if(service!=null)
			{
				service.ComponentChanged+=new ComponentChangedEventHandler(this.OnComponentChanged);
			}
			PropertyDescriptor descriptor=TypeDescriptor.GetProperties(component)["Locked"];
			if((descriptor!=null)&&(this.collapsibleContainerPanel.Parent is CollapsibleContainer))
			{
				descriptor.SetValue(component, true);
			}
		}