public CollapsibleControl AddCollapsibleControlFor(System.Windows.Controls.UserControl wpfControl, int expandedHeight, string label) { if (expandedHeight == -1) { expandedHeight = (int)wpfControl.Height; } CollapsibleControl newControl = AddCollapsibleControl(expandedHeight); newControl.SuspendLayout(); newControl.Label = label; System.Windows.Forms.Integration.ElementHost wpfHost; wpfHost = new System.Windows.Forms.Integration.ElementHost(); wpfHost.Dock = DockStyle.Fill; wpfHost.Child = wpfControl; newControl.Controls.Add(wpfHost); wpfHost.Dock = DockStyle.Fill; wpfHost.BringToFront(); newControl.ResumeLayout(); return(newControl); }
public CollapsibleControl AddCollapsibleControlForReduced(Control control, int expandedHeight = 50, string label = "Collapsible Control") { if (expandedHeight == -1) { expandedHeight = control.Height; } CollapsibleControl newControl; { newControl = new CollapsibleControl(); newControl.Width = this.Width; newControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; newControl.ExpandedHeight = 28 + expandedHeight; newControl.Height = newControl.ExpandedHeight; newControl.CollapseChange += new EventHandler(OnCollapseChange); this.Controls.Add(newControl); UpdatePositions(); } newControl.Label = label; newControl.Controls.Add(control); control.Dock = DockStyle.Fill; control.BringToFront(); return(newControl); }
public Control GetControlByLabel(string label) { foreach (var control in this.Controls) { if (control is CollapsibleControl) { CollapsibleControl container = control as CollapsibleControl; if (container.Label == label && container.Controls.Count != 0) { return(container.Controls[0]); } } } return(null); }
private void AddCategory(Control categoryLabel, IEnumerable <PropertyData> enumerable) { this.AddCategory(categoryLabel); if (categoryLabel is CollapsibleControl) { CollapsibleControl collapsibleControl = (CollapsibleControl)categoryLabel; collapsibleControl.CollapsedOrExpanded += (sender, args) => { this.SuspendLayout(); foreach (PropertyData data in enumerable) { if (data.LabelControl != null) { if (collapsibleControl.Collapse) { data.LabelControl.Hide(); } else { data.LabelControl.Show(); } } if (data.EditorControl != null) { if (collapsibleControl.Collapse) { data.EditorControl.Hide(); } else { data.EditorControl.Show(); } } } this.ResumeLayout(true); }; } foreach (PropertyData data in enumerable) { this.AddProperty(data); } }
public CollapsibleControl AddCollapsibleControl(int expandedHeight= 50, string label = "Collapsible Control") { SuspendLayout(); CollapsibleControl newControl = new CollapsibleControl(); this.Controls.Add(newControl); newControl.Width = this.Width - SubtractFromWidthForControlWidth; //newControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; newControl.ExpandedHeight = 28 + expandedHeight; newControl.Height = newControl.ExpandedHeight; newControl.CollapseChange += new EventHandler(OnCollapseChange); UpdatePositions(); ResumeLayout(); return newControl; }
public CollapsibleControl AddCollapsibleControl(int expandedHeight = 50, string label = "Collapsible Control") { SuspendLayout(); CollapsibleControl newControl = new CollapsibleControl(); this.Controls.Add(newControl); newControl.Width = this.Width - SubtractFromWidthForControlWidth; //newControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; newControl.ExpandedHeight = 28 + expandedHeight; newControl.Height = newControl.ExpandedHeight; newControl.CollapseChange += new EventHandler(OnCollapseChange); UpdatePositions(); ResumeLayout(); return(newControl); }
/// <summary> /// Crea la categoria. /// </summary> protected virtual Control CreateCategory(string nombre) { CollapsibleControl label = new CollapsibleControl(); label.Name = nombre + "_label"; label.Text = nombre; label.LeftColor = label.BackColor; label.RightColor = label.BackColor; label.ShowHeaderSeparator = false; label.Gap = this.CategoryGap; label.AutoSize = this.CategoryAutoSize; label.Anchor = this.CategoryAnchor; label.Dock = this.CategoryDock; label.Padding = this.CategoryPadding; label.Margin = this.CategoryMargin; label.Gap = 0; label.RightColor = Color.FromArgb(64, 0, 0, 64); return(label); }
public CollapsibleControl AddCollapsibleControlFor(Control control, int expandedHeight = 50, string label = "Collapsible Control") { if (expandedHeight == -1) { expandedHeight = control.Height; } CollapsibleControl newControl = AddCollapsibleControl(expandedHeight); newControl.SuspendLayout(); newControl.Label = label; newControl.Controls.Add(control); control.Dock = DockStyle.Fill; control.BringToFront(); int m = 3; newControl.ResumeLayout(); return(newControl); }
public CollapsibleControl AddCollapsibleControlForReduced(Control control, int expandedHeight = 50, string label = "Collapsible Control") { if (expandedHeight == -1) { expandedHeight = control.Height; } CollapsibleControl newControl; { newControl = new CollapsibleControl(); newControl.Width = this.Width; newControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; newControl.ExpandedHeight = 28 + expandedHeight; newControl.Height = newControl.ExpandedHeight; newControl.CollapseChange += new EventHandler(OnCollapseChange); this.Controls.Add(newControl); UpdatePositions(); } newControl.Label = label; newControl.Controls.Add(control); control.Dock = DockStyle.Fill; control.BringToFront(); return newControl; }