تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ListBox DragDrop تعديل هذا الكود
#6
sajad كتب :السلام عليكم

اعتقد الحل من خلال هذا الكود في الDragEnter

PHP كود :
If (e.Data.GetDataPresent(TypeOf e.Data Is Imaging.ImageFormat)) Then
            e
.Effect DragDropEffects.All
        End 
If 

محمد كتب :جزاك الله خير شكرآ اخى
هل يمكن ايضآ مع الملفات الصوتية وى exe و ملفات الفيديو ?
جربت بى وضع Extension.ExtensionFormat
و Midea.MideaFormat
ولم ينفع

RainBow كتب :هذا هو الكود المطلوب
كود :
Dim s() As String = e.Data.GetData("FileDrop", False)
        Dim i As Integer
        Dim AllowedTypes As String = ".jpg .mp3 .exe"
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            MyFiles = e.Data.GetData(DataFormats.FileDrop)
            MyNames = e.Data.GetData(DataFormats.FileDrop)
            Dim name As String
            For i = 0 To MyFiles.Length - 1
                If AllowedTypes.Contains(Path.GetExtension(s(i))) Then
                    fileinfo = New IO.FileInfo(MyNames(i))
                    name = fileinfo.Name.Remove(fileinfo.Name.Length - 4, 4)
                    ListBox2.Items.Add(name)
                End If
            Next
            For i = 0 To MyFiles.Length - 1
                If AllowedTypes.Contains(Path.GetExtension(s(i))) Then
                    ListBox1.Items.Add(MyFiles(i))
                End If
            Next
        End If
جزاكم الله خير اخوتى
هذا الذى احتاجة اخى Rain
أبورائد لماذا لا يظهر زر الشكر و الاعجاب عندك !
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
ListBox DragDrop تعديل هذا الكود - بواسطة Sajad - 26-03-13, 07:43 PM
ListBox DragDrop تعديل هذا الكود - بواسطة RainBow - 26-03-13, 09:27 PM
ListBox DragDrop تعديل هذا الكود - بواسطة محمد_mybb_import4755 - 26-03-13, 09:51 PM


التنقل السريع :


يقوم بقرائة الموضوع: