Posted 18 years ago
by Paul Hasselfeldt
ActiproSoftware.SyntaxEditor.Net20, Version=3.1.211.0
Needing some help getting the drag and drop operations to work within the editor. I have tried using the PasteDragDrop event which will fire and go through the first "if" in the code below, setting the e.DragEventArgs.Effect property and all but it will not change the cursor and a second event is never fired to detect the drop. Also I can't seem to get the DragEnter and DragDrop events to fire either.Thanks,
Paul
Needing some help getting the drag and drop operations to work within the editor. I have tried using the PasteDragDrop event which will fire and go through the first "if" in the code below, setting the e.DragEventArgs.Effect property and all but it will not change the cursor and a second event is never fired to detect the drop. Also I can't seem to get the DragEnter and DragDrop events to fire either.
private void editor_PasteDragDrop(object sender, PasteDragDropEventArgs e)
{
if (e.Source == PasteDragDropSource.DragEnter)
{
object files = e.DataObject.GetData(DataFormats.FileDrop);
if ((files is string[]) && (((string[])files).Length > 0))
{
string sFile = ((string[])files)[0];
if (sFile.EndsWith(".xml", StringComparison.OrdinalIgnoreCase))
e.DragEventArgs.Effect = DragDropEffects.Copy;
}
}
else if (e.Source == PasteDragDropSource.DragDrop)
{
OpenFile(((string[])e.DataObject.GetData(DataFormats.FileDrop))[0]);
}
}
Paul