How To Drag And Drop Image From Desktop To PictureBox In C#
____________________________________________________________
In This C# Code We Will See How To You Can Drag Image From Your DesKtop And Drop It In The PictureBox In CSharp Programming Language .
Project Source Code:
In This C# Code We Will See How To You Can Drag Image From Your DesKtop And Drop It In The PictureBox In CSharp Programming Language .
Project Source Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Project : Form { public Project() { InitializeComponent(); pictureBox1.AllowDrop = true; } private void pictureBox1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; } private void pictureBox1_DragDrop(object sender, DragEventArgs e) { foreach(string pic in ((string[])e.Data.GetData(DataFormats.FileDrop))) { Image img = Image.FromFile(pic); pictureBox1.Image = img; } } } }
Image From Desktop To PictureBox In C# |