/// <summary> /// Konstruktor für das <see cref="SuchControl"/> /// </summary> public SuchControl() { InitializeComponent(); Suche = new List <SucheRow>(); SucheRow row = new SucheRow { LinkControl = comboLink, SpalteControl = comboSpalte, ValueControl = tbSuche, AnfangControl = dtpAnfang, EndeControl = dtpEnde, CheckControl = cbSuche, }; row.LinkControl.Visible = false; row.AnfangControl.Visible = false; row.EndeControl.Visible = false; row.CheckControl.Visible = false; _lstRow.Add(row); }
/// <summary> /// Methode zum Hinzufügen einer zusätzlichen Suchzeile im <see cref="SuchControl"/> /// </summary> private void AddControls() { SucheRow row = new SucheRow(); ComboBox comboLinkVorlage = new ComboBox(); ComboBox comboSpalteVorlage = new ComboBox(); TextBox tbSucheVorlage = new TextBox(); DateTimePicker dtpAnfangVorlage = new DateTimePicker(); DateTimePicker dtpEndeVorlage = new DateTimePicker(); CheckBox cbSucheVorlage = new CheckBox(); CheckBox cbErledigtVorlage = new CheckBox(); Controls.Add(comboLinkVorlage); Controls.Add(comboSpalteVorlage); Controls.Add(tbSucheVorlage); Controls.Add(dtpAnfangVorlage); Controls.Add(dtpEndeVorlage); Controls.Add(cbSucheVorlage); comboLinkVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Left; comboLinkVorlage.FormattingEnabled = true; comboLinkVorlage.Location = new Point(7, _lstRow.Last().LinkControl.Location.Y + 30); comboLinkVorlage.Name = "comboLinkVorlage_" + _lstRow.Count.ToString(); comboLinkVorlage.Size = new Size(56, 21); comboLinkVorlage.TabIndex = 2; comboLinkVorlage.Items.AddRange(new object[] { "und", "oder" }); comboLinkVorlage.SelectedIndex = 0; comboSpalteVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Left; comboSpalteVorlage.FormattingEnabled = true; comboSpalteVorlage.Location = new Point(69, _lstRow.Last().SpalteControl.Location.Y + 30); comboSpalteVorlage.Name = "comboSpalteVorlage_" + _lstRow.Count.ToString(); comboSpalteVorlage.Size = new Size(133, 21); comboSpalteVorlage.TabIndex = 3; comboSpalteVorlage.SelectedIndexChanged += ComboSpalteVorlage_SelectedIndexChanged; foreach (var spalte in Spalten) { comboSpalteVorlage.Items.Add(spalte); } tbSucheVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tbSucheVorlage.Location = new Point(_lstRow[0].ValueControl.Location.X, _lstRow.Last().ValueControl.Location.Y + 30); tbSucheVorlage.Name = "tbSucheVorlage_" + _lstRow.Count.ToString(); tbSucheVorlage.Size = new Size(_lstRow[0].ValueControl.Width, 20); tbSucheVorlage.TabIndex = 4; dtpAnfangVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; dtpAnfangVorlage.Location = new Point(_lstRow[0].AnfangControl.Location.X, _lstRow.Last().AnfangControl.Location.Y + 30); dtpAnfangVorlage.Name = "dtpAnfangVorlage_" + _lstRow.Count.ToString(); dtpAnfangVorlage.Size = new Size(_lstRow[0].AnfangControl.Width, 20); dtpAnfangVorlage.TabIndex = 5; dtpAnfangVorlage.Visible = false; dtpEndeVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Right; dtpEndeVorlage.Location = new Point(_lstRow[0].EndeControl.Location.X, _lstRow.Last().EndeControl.Location.Y + 30); dtpEndeVorlage.Name = "dtpEndeVorlage_" + _lstRow.Count.ToString(); dtpEndeVorlage.Size = new Size(_lstRow[0].EndeControl.Width, 20); dtpEndeVorlage.TabIndex = 6; dtpEndeVorlage.Visible = false; cbSucheVorlage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; cbSucheVorlage.Location = new Point(_lstRow[0].CheckControl.Location.X, _lstRow.Last().CheckControl.Location.Y + 30); cbSucheVorlage.Name = "cbSucheVorlage_" + _lstRow.Count.ToString(); cbSucheVorlage.Size = new Size(_lstRow[0].CheckControl.Width, 20); cbSucheVorlage.TabIndex = 7; cbSucheVorlage.Visible = false; row.LinkControl = comboLinkVorlage; row.SpalteControl = comboSpalteVorlage; row.ValueControl = tbSucheVorlage; row.AnfangControl = dtpAnfangVorlage; row.EndeControl = dtpEndeVorlage; row.CheckControl = cbSucheVorlage; _lstRow.Add(row); }