• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 4 رای - 1.75 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Drag and Drop With List Box
حالت موضوعی
#1




Drag and Drop is an amazing feature to add to your application when you are trying to create a slick and intuitive interface for your end users. It also adds a wow factor that impresses people when they first start using an application. Another great benefit of adding drag and drop functionality to your application is that it is very logical for the user. In real life if I want to move a piece of paper from one stack to another I simply pick it up, move it, and place it in the new stack. This is the exact same gesture I go through with Drag and Drop.

To use this source sample create a new VB project, add a listbox control to the form and set its DragMode property to Automatic. Go to the code window and add the following code.








کد:
'Add Control listbox
Private Sub Form_Load()
'List1.OLEDragMode = 0
List1.OLEDropMode = 1
End Sub

Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ItemCount As Integer
Dim I As Integer
On Error Resume Next
ItemCount = Data.Files.Count
For I = 1 To ItemCount
    List1.AddItem Data.Files(I)
Next
If Err Then Err.Clear
End Sub


با کد بالا که ادیتش هم کردم میتونید در لیست باکستون فایل اضافه کنید یا درگ کنید (با ماوس فایل رو میگیرید و داخل لیست باکس رها میکنید , ادرس فایل ها در لیست باکس اضافه میشن )

گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


پرش به انجمن:


Browsing: