Quantcast
Viewing all articles
Browse latest Browse all 18858

When Drag-n-Drop file (FileDrop), the indicator doesn't change [VS 2013 Preview]

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 Sub
Private Sub OnGiveFeedbackExcel(sender As Object, e As GiveFeedbackEventArgs) Handles Me.GiveFeedback
     If e.Effects = DragDropEffects.None Then Mouse.SetCursor(Cursors.No)
End Sub

However, 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.



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>