public void RemoveItem(string TBText) { DraggableTB tb = GetItem(TBText); if (tb != null) { items.Remove(tb); ContentPanel.Controls.Remove(tb); } }
public void AddItem(string TBText) { if (!HasItem(TBText)) { DraggableTB tb = new DraggableTB(); tb.TBText = TBText; tb.textBox.TextChanged += new EventHandler(textBox_TextChanged); items.Add(tb); ContentPanel.Controls.Add(tb); tb.Dock = DockStyle.Left; tb.BringToFront(); } }
void textBox_TextChanged(object sender, EventArgs e) { TextBox box = sender as TextBox; DraggableTB tb = GetItem(box.Text); if (box.Text == "" || (tb != null && tb.textBox != box)) { box.BackColor = Color.Red; } else { box.BackColor = SystemColors.Window; } }