I do drag-and-drop operation for Excel files, so I wrote the following handler for DragEnter (Window):
Private Sub OnExcelFileDragEnter(sender As Object, e As DragEventArgs) Handles Me.DragEnter
e.Effects = DragDropEffects.Copy
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim fileName = DirectCast(e.Data.GetData(DataFormats.FileDrop), String())(0)
Dim ext = System.IO.Path.GetExtension(fileName)
If {".XLSX", ".XLSM"}.Contains(ext.ToUpper()) Then
e.Effects = DragDropEffects.Copy
Else
e.Effects = DragDropEffects.None
End If
Else
e.Effects = DragDropEffects.None
End If
End SubPrivate Sub OnGiveFeedbackExcel(sender As Object, e As GiveFeedbackEventArgs) Handles Me.GiveFeedback
If e.Effects = DragDropEffects.None Then Mouse.SetCursor(Cursors.No)
End SubHowever, the mouse pointer isn't changed to the forbidding circle-with-a-line cursor. Is there something I have missed?
There is no knowledge that is not power.







