Hi,
I want to have another copy of some control upon dragging and dropping it to another form. My code results in moving the whole control. Is there a way to have the two of them being displayed at once given that I want them to have the same reference because the source updates values every second.
here's my code
public partial class DragDropForm : Form
{
public DragDropForm()
{
InitializeComponent();
}
private void tableLayoutPanel1_DragEnter(object sender, DragEventArgs e)
{
object data = e.Data.GetData(e.Data.GetFormats()[0]);
if (data is GaugeContainer)
{
GaugeContainer gauge = data as GaugeContainer;
tableLayoutPanel1.Controls.Add(gauge);
}
else if (data is DataGridView)
{
DataGridView table = data as DataGridView;
tableLayoutPanel1.Controls.Add(table);
}
}
private void tableLayoutPanel1_DragDrop(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy ;
}
}
// IN THE SOURCE FORM !!!!
private void topCompaniesGridView_MouseDown(object sender, MouseEventArgs e)
{
this.DoDragDrop(this.topCompaniesGridView, DragDropEffects.Copy);
}