Всем привет зашел задать вопрос. как сделать, что бы изображение передавалось Drag&Drop'oм только в смежные PB'ы.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void PB1_MouseDown(object sender, MouseEventArgs e)
{
PictureBox pb1 = (PictureBox)sender;
pb1.Select();
pb1.DoDragDrop(pb1.Image, DragDropEffects.Move);
}
private void PB1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Bitmap))
{
e.Effect = DragDropEffects.Move;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void PB1_DragDrop(object sender, DragEventArgs e)
{
PictureBox pb = (PictureBox)sender;
pb.Image=(Bitmap)e.Data.GetData(DataFormats.Bitmap);
}