the above code pasted can only drag the button but not into the picturebox. pls help.
hi,
i need to drag a button into a picturebox and when the button is dragged inside the picturebox, i want it to be able to move around also.
but my code i did only allow me to drag the button but not into the picturebox.
my code:
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
Panel source = (Panel)sender;
DoDragDrop(source.BackgroundImage, DragDropEffects.Copy);
}
private void pictureBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Bitmap)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void pictureBox1_DragDrop(object sender, DragEventArgs e)
{
Panel destination = (Panel)sender;
destination.BackgroundImage = (Bitmap)e.Data.GetData(typeof(Bitmap));
}
need help. thank you (: