private void AddPart(StandardPart <Control> part, int index) { // we're going to be internally consistent layout.SuspendLayout(); var control = new StandardPartView(part); control.Dock = DockStyle.Fill; layout.RowStyles.Insert(index, new RowStyle(SizeType.AutoSize)); // shift all controls after this point down one row // (the last row will have nothing in it, the row of index will have an existing control for (int i = layout.RowStyles.Count - 2; i >= index; i--) { var move = layout.GetControlFromPosition(0, i); if (move != null) { layout.SetCellPosition(move, new TableLayoutPanelCellPosition(0, i + 1)); } } layout.Controls.Add(control, 0, index); layout.ResumeLayout(); // update height outside SuspendLayout or it won't recalculate correctly ScrollHeight += ControlHeight(control); }
protected override void OnPartChanged(StandardPart<UIElement> part, PropertyChangedEventArgs e) { base.OnPartChanged(part, e); if (new [] { "SelectedPath", "SelectedBuilder" }.Contains(e.PropertyName)) part.Parser = Parser.Create(part.SelectedPath, part.SelectedBuilder); }
protected override void OnPartChanged(StandardPart <UIElement> part, PropertyChangedEventArgs e) { base.OnPartChanged(part, e); if (new [] { "SelectedPath", "SelectedBuilder" }.Contains(e.PropertyName)) { part.Parser = Parser.Create(part.SelectedPath, part.SelectedBuilder); } }
public StandardPartView(StandardPart<Control> part) { InitializeComponent(); cboPath.Size = new Size(1, 1); cboBuilder.Size = new Size(1, 1); dbqf.WinForms.Extensions.ComboBoxExtension.AdjustWidthOnDropDown(cboPath, cboBuilder); _part = part; _part.PropertyChanged += Part_PropertyChanged; bsPart.DataSource = _part; CreateElement(); }
public StandardPartView(StandardPart <Control> part) { InitializeComponent(); cboPath.Size = new Size(1, 1); cboBuilder.Size = new Size(1, 1); dbqf.WinForms.Extensions.ComboBoxExtension.AdjustWidthOnDropDown(cboPath, cboBuilder); _part = part; _part.PropertyChanged += Part_PropertyChanged; bsPart.DataSource = _part; CreateElement(); }
private void AddPart(StandardPart<Control> part, int index) { // we're going to be internally consistent layout.SuspendLayout(); var control = new StandardPartView(part); control.Dock = DockStyle.Fill; layout.RowStyles.Insert(index, new RowStyle(SizeType.AutoSize)); // shift all controls after this point down one row // (the last row will have nothing in it, the row of index will have an existing control for (int i = layout.RowStyles.Count - 2; i >= index; i--) { var move = layout.GetControlFromPosition(0, i); if (move != null) layout.SetCellPosition(move, new TableLayoutPanelCellPosition(0, i + 1)); } layout.Controls.Add(control, 0, index); layout.ResumeLayout(); // update height outside SuspendLayout or it won't recalculate correctly ScrollHeight += ControlHeight(control); }