Sub Process_Globals
'...
Private DragnDrop As DragAndDrop
'...
End Sub
Sub AppStart (Form1 As Form, Args() As String)
'...
DragnDrop.MakeDragTarget(cmbAPK, "cmbAPK")
'...
End Sub
Sub cmbAPK_DragOver(e As DragEvent)
For Each id As String In e.GetDataIds
If id = "text/uri-list" Then
Dim Links() As Object = Array As String(e.GetDataObjectForId("text/uri-list"))
If Links.Length > 0 Then
For Each link As String In Links
If link.ToLowerCase.EndsWith(".apk") Then
e.AcceptTransferMode("LINK")
cmbAPK.Style = $"-fx-border-color: -fx-focus-color; -fx-border-size: 15;"$
Return
End If
Next
End If
Exit
End If
Next
e.Consume
End Sub
Sub cmbAPK_DragDropped(e As DragEvent)
Dim TextLinks As String = e.GetDataObjectForId("text/uri-list")
If TextLinks <> "" Then
Dim Links() As String = Regex.Split("\r\n", TextLinks)
If Links.Length > 0 Then
For Each Link As String In Links
If Link.StartsWith("file:/") Then
Link = Link.SubString(6)
End If
If cmbAPK.Items.IndexOf(Link) = -1 Then
cmbAPK.Items.Add(Link)
End If
cmbAPK.SelectedIndex = cmbAPK.Items.IndexOf(Link)
Next
End If
End If
e.SetDropCompleted(True)
e.Consume
End Sub
Sub cmbAPK_DragExited(e As DragEvent)
cmbAPK.Style = $"-fx-border-color: none; -fx-border-size: 0;"$
End Sub