private void btnAdd_Click(object sender, EventArgs e) { MyPanel myPanel = new MyPanel(); Button btn = (Button)sender; MyTextBox myTextBox = new MyTextBox(); myTextBox.txtBox.Multiline = true; myTextBox.txtBox.Size = new Size(100, 50); myTextBox.txtBox.MouseDown += txtBox_MouseDown; myPanel = scrumTable.SearchPanelInList(btn.Name); myPanel.tableLayoutPanel.Controls.Add(myTextBox.txtBox); }
private void txtBox_MouseDown(object sender, MouseEventArgs e) { MyTextBox myTextBox = new MyTextBox(); myTextBox.txtBox = (TextBox)sender; if (e.Button == MouseButtons.Left) { MyPanel myPanel = new MyPanel(); myPanel.tableLayoutPanel = (TableLayoutPanel)myTextBox.txtBox.Parent; myPanel = scrumTable.SearchPanelInList(myPanel.panel.Name); transformingTextBox = myTextBox.txtBox; myTextBox.txtBox.DoDragDrop(transformingTextBox, DragDropEffects.Move); } else if (e.Button == MouseButtons.Right) { myTextBox.txtBox.ContextMenuStrip = createResponsible; } }