private void picUp_DragDrop(object sender, DragEventArgs e)
{
try
{
//Array[] filePaths = (Array[])(e.Data.GetData(DataFormats.FileDrop));
picUp.Image = Image.FromFile(((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString());
}
catch (Exception ex)
{
MessageBox.Show("Error Doing Drag/Drop");
}
}
private void picUp_DragEnter(object sender, DragEventArgs e)
{
if ((e.Data.GetDataPresent(DataFormats.FileDrop)))
{
e.Effect = DragDropEffects.Copy;
}
{
try
{
//Array[] filePaths = (Array[])(e.Data.GetData(DataFormats.FileDrop));
picUp.Image = Image.FromFile(((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString());
}
catch (Exception ex)
{
MessageBox.Show("Error Doing Drag/Drop");
}
}
private void picUp_DragEnter(object sender, DragEventArgs e)
{
if ((e.Data.GetDataPresent(DataFormats.FileDrop)))
{
e.Effect = DragDropEffects.Copy;
}
}
    例子:/Files/xiongeee/WindowsFormsApplication1.rar
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号