C#: Drag&Drop
Von: , Frage gestellt am Mi, 13. Jul 2005
Hallo,
Ich möchte nur Drag und Drop implementieren. Dazu ziehe ich eine Datei vom Explorer auf meine Anwendung. Allerdings ist die Ausgabe nur
onDrop
System.String[]
aber nicht der Dateiname. Was mache ich falsch?
PS: Habe erst vor einigen Tagen mit C# angefangen.
Chris
-------
private void MainForm_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
// a file dropped from windows explorer has the formats:
//Shell IDList Array, Shell Object Offsets, DragImageBits, DragContext, InShellDragLoop, FileDrop, FileNameW, FileName
Trace.WriteLine("onDrop");
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
string test3 = e.Data.GetData(DataFormats.FileDrop, false).ToString();
Trace.WriteLine(test3);
}
}
