Good evening, I would like to associate a common event for all the label_DragOver and label_DragDrop ... such thing would be possible?
string _currLabel = string.Empty;
private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add("lol1");
listBox1.Items.Add("lol2");
listBox1.Items.Add("lol3");
listBox1.Items.Add("lol4");
listBox1.Items.Add("lol5");
}
private void listBox1_MouseDown(object sender, MouseEventArgs e)
{
if(listBox1.SelectedItem!=null)
{
DragDropEffects _effect = DoDragDrop(listBox1.SelectedItem,
DragDropEffects.All);
}
}
private void ChangeLabelName(Label c)
{
c.Text = _selectedItem();
}
private string _selectedItem()
{
return listBox1.GetItemText(listBox1.SelectedItem);
}
private void label1_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}
private void label1_DragDrop(object sender, DragEventArgs e)
{
Label s = (Label)sender;
ChangeLabelName(s);
}