private SimpleFilterUI AddFilter(ExtractionFilter f) { var filterUI = new SimpleFilterUI(_activator, f); filterUI.RequestDeletion += () => RemoveFilter(filterUI); filterUI.Width = tableLayoutPanel1.Width; filterUI.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; tableLayoutPanel1.Controls.Add(filterUI, tableLayoutPanel1.RowCount - 1, 0); //this array always seems to be 1 element long.. tableLayoutPanel1.RowStyles[0].SizeType = SizeType.AutoSize; _filterUIs.Add(filterUI); //if there are 2+ filters then user can specify AND / OR to combine them ddAndOr.Enabled = _filterUIs.Count >= 2; return(filterUI); }
private void RemoveFilter(SimpleFilterUI filterUI) { _filterUIs.Remove(filterUI); tableLayoutPanel1.Controls.Remove(filterUI); }