public Item(AmazonSearchParametersControl container, ItemType itemType) { this.Container = container; this.ItemType = itemType; int nTopBlank = 0; // (int)this.Container.Font.GetHeight() + 2; label = new Label(); label.Dock = DockStyle.Fill; label.Size = new Size(70, 28); label.AutoSize = true; label.TextAlign = ContentAlignment.MiddleRight; label.Margin = new Padding(1, 0, 1, 0); if (this.ItemType == AmazonSearchParametersControl.ItemType.TextBox) { this.textBox = new TextBox(); textBox.BorderStyle = BorderStyle.None; textBox.Dock = DockStyle.Fill; textBox.MinimumSize = new Size(80, 24); // textBox_price.Multiline = true; textBox.Margin = new Padding(6, nTopBlank + 6, 6, 0); textBox.ForeColor = this.Container.tableLayoutPanel_content.ForeColor; } if (this.ItemType == AmazonSearchParametersControl.ItemType.ComboBox) { comboBox = new TabComboBox(); comboBox.RemoveRightPartAtTextBox = false; comboBox.DropDownStyle = ComboBoxStyle.DropDown; comboBox.FlatStyle = FlatStyle.Flat; comboBox.Dock = DockStyle.Fill; // comboBox.MaximumSize = new Size(150, 28); comboBox.Size = new Size(100, 28); comboBox.MinimumSize = new Size(50, 28); comboBox.DropDownHeight = 300; comboBox.DropDownWidth = 300; comboBox.ForeColor = this.Container.tableLayoutPanel_content.ForeColor; comboBox.Text = ""; comboBox.Margin = new Padding(6 - 4, nTopBlank + 6 - 2, 6, 2); } }
void DisposeChildControls() { if (label != null) { label.Dispose(); label = null; } if (textBox != null) { textBox.Dispose(); textBox = null; } if (comboBox != null) { comboBox.Dispose(); comboBox = null; } Container = null; }