C# 接收拖放至窗体的文件路径 如题:有人说把窗体的AllowDrop设置为True就可以,问题是我生成的DragDrop事件处理方法没反应,DragEnter倒是触发到了。我的目的是当用户拖放一个文件到窗体上的时候获取该文件的路径,然后 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void textBox1_DragDrop(object sender, DragEventArgs e){ if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop); // paths[0] 为第1个文件全路径 }} 我的问题是:private void textBox1_DragDrop(object sender, DragEventArgs e){ MessageBox.Show("拖放"); //没反应,AllowDrop已设置为true} private void textBox1_DragEnter(object sender, DragEventArgs e){ if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; } else { e.Effect = DragDropEffects.None; }}private void textBox1_DragDrop(object sender, DragEventArgs e) { MessageBox.Show("拖放");} c# 怎样使得dll不用生成对象直接使用里面的方法 long型怎样转成byte[] 型 关于IQueryable类型取数据的问题 事件调用问题 关于winform程序的发布和部署的问题 C# CRC校验码的算法 Socket发包量比较大的时候,接受不到,帮帮我解决这个问题。 console的输出 ODBC数据信息的访问Foxpro及Access数据出错请帮解答 显示图片延时问题--有点可怕~ 依旧是VS2005与SQL2005的连接问题 想在打印预览中添加打印当前页?
private void textBox1_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop);
// paths[0] 为第1个文件全路径
}
}
{
MessageBox.Show("拖放"); //没反应,AllowDrop已设置为true
}
private void textBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}private void textBox1_DragDrop(object sender, DragEventArgs e)
{
MessageBox.Show("拖放");
}