Public Function ExteJudge(ByVal FN As String) As Boolean
If System.IO.Path.HasExtension(FN) = False Then Return True
Dim Extes() As String = {".ai", ".eps"}
Dim Exte As String = String.Empty
For Each Exte In Extes
If Exte = System.IO.Path.GetExtension(FN) Then
Return True
End If
Next
Return False
End Function
Private Sub DragEnter_(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter, ListBox2.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub DragDrop_(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop, ListBox2.DragDrop
Dim obj As ListBox = CType(sender, ListBox)
Dim FileNames As String() = CType(e.Data.GetData(DataFormats.FileDrop, False), String())
Dim files As String()
For Each FName As String In FileNames
If GetAttr(FName) = FileAttribute.Directory Then
files = System.IO.Directory.GetFiles(FName)
For Each FileName As String In files
If ExteJudge(FileName) = 1 Then
ContAdd(FileName)
ElseIf ExteJudge(FileName) = 2 Then
CheckBox4.Checked = True : TextBox1.Text = Dir(FileName) : ExcelFilePath = FileName
End If
Next
Else
If ExteJudge(FName) = 1 Then
ContAdd(FName)
ElseIf ExteJudge(FName) = 2 Then
CheckBox4.Checked = True : TextBox1.Text = Dir(FName) : ExcelFilePath = FName
End If
End If
Next
If Fs.Count = 0 Then
Console.WriteLine("適切なファイルが選択されていません")
Exit Sub
Else
Fs.Sort()
ListBox1.Items.Clear()
For Each aaa As String In Fs
ListBox1.Items.Add(Dir(aaa))
Next
End If
End Sub