I am trying to write a program that will allow the user to drag and drop images into the program, and then be able to select an image, move it, resize, crop, etc.
So far I have created a window form consisting of a panel. The user can drag the image file onto the panel, and the image will be created in the coordinates of the mouse when it is reset, and the image will be loaded into the image window. I can add multiple images this way.
Now I want to allow the user to manipulate and move the images that they dropped into the panel.
I tried to find solutions, but did not seem to find an answer that I understand.
Any help is greatly appreciated.
This is my current code.
private void panel1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.All; } private void panel1_DragDrop(object sender, DragEventArgs e) { String[] imagePaths = (String[])e.Data.GetData(DataFormats.FileDrop); foreach (string path in imagePaths) { Point point = panel1.PointToClient(Cursor.Position); PictureBox pb = new PictureBox(); pb.ImageLocation = path; pb.Left = point.X; pb.Top = point.Y; panel1.Controls.Add(pb);
source share