我只是想知道如何从列表框中拖动项目并将其放入图像中,然后从列表框中删除该值。 这是我到目前为止的代码;
private void Form1_Load(object sender, EventArgs e)
{
textBox1.AllowDrop = true;
pictureBox1.AllowDrop = true;
}
private void listBox1_MouseDown(object sender, MouseEventArgs e)
{
if ( listBox1.Items.Count > 0 )
listBox1.DoDragDrop( /* ? */ , DragDropEffects.Move); //This
statement is incomplete!
}
private void textBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void textBox1_DragDrop(object sender, DragEventArgs e)
{
//Code to copy selected List Box entry to Text Box and remove original entry
}
private void pictureBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void pictureBox1_DragDrop(object sender, DragEventArgs e)
{
//Code to remove selected entry from List Box
}
任何帮助将不胜感激, 非常感谢