void c_DragDrop(object sender, DragEventArgs e) { PictureBox self = (PictureBox)sender; if (self.Image == null) { self.Image = (Image)e.Data.GetData(DataFormats.Bitmap); if ((Image)e.Data.GetData(DataFormats.Bitmap) == pictureBox17.Image) { Simulation.AddCrossing(new Crossing_A(GetNumberOfPicturebox(self), new Point(self.Location.X, self.Location.Y), null), GetNumberOfPicturebox(self)); } else { Simulation.AddCrossing(new Crossing_B(GetNumberOfPicturebox(self), new Point(self.Location.X, self.Location.Y), null), GetNumberOfPicturebox(self)); } } else { MessageBox.Show("Remove the crossing first to be able to add another one on this tile", "There is already a crossing there"); } }
void c_DragDrop(object sender, DragEventArgs e) { if (isLocked) { return; } PictureBox self = (PictureBox)sender; if (self.Image == null) { crossPic.Add(self); bool result = false; int picBoxNumber = GetNumberOfPicturebox(self); Image finalImage; if ((Image)e.Data.GetData(DataFormats.Bitmap) == crossingType1.Image) { result = Simulation.AddCrossing(new Crossing_A(picBoxNumber)); finalImage = ProCP.Properties.Resources.Crossing_a; } else { result = Simulation.AddCrossing(new Crossing_B(picBoxNumber)); finalImage = ProCP.Properties.Resources.Crossing_b; } if (result) { self.Image = (Image)e.Data.GetData(DataFormats.Bitmap); } return; } MessageBox.Show("Remove the crossing first to be able to add another one on this tile", "There is already a crossing there"); }