private void AddFilter(Filter filter) { Content.Filters.Add(filter); int rowIndex = Content.Filters.Count; tableLayoutPanel.SuspendLayout(); tableLayoutPanel.RowCount++; tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize)); Button removeButton = new Button(); removeButton.Size = new System.Drawing.Size(24, 24); removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right; removeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove; removeButton.Tag = filter; removeButton.Click += new System.EventHandler(removeButton_Click); tableLayoutPanel.Controls.Add(removeButton, 0, rowIndex); ContentView filterView = (ContentView)MainFormManager.CreateDefaultView(filter.GetType()); filterView.Content = filter; filterView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tableLayoutPanel.Controls.Add(filterView, 1, rowIndex); tableLayoutPanel.ResumeLayout(); }