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;
using System.Diagnostics;
namespace Walter.K.Wang
{
public partial class Form1 : Form
{
private Process process = new Process();
public Form1()
{
InitializeComponent();
}
private void listBox1_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
string[] files;
files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
{
listBox1.Items.Add(file);
}
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
if (listBox1.SelectedIndex >= 0)
{
process.StartInfo.FileName = Convert.ToString(listBox1.SelectedItem);
process.Start();
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace Walter.K.Wang
{
public partial class Form1 : Form
{
private Process process = new Process();
public Form1()
{
InitializeComponent();
}
private void listBox1_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
string[] files;
files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
{
listBox1.Items.Add(file);
}
}
private void listBox1_DoubleClick(object sender, EventArgs e)
{
if (listBox1.SelectedIndex >= 0)
{
process.StartInfo.FileName = Convert.ToString(listBox1.SelectedItem);
process.Start();
}
}
}
}