vb.net listbox,VB.NET中如何让LISTBOX控件可以拖放文件

VB.NET中如何让LISTBOX控件可以拖放文件 - 故障解答 - 电脑教程网

VB.NET中如何让LISTBOX控件可以拖放文件

日期:2007-05-17   荐:
VB.NET中如何让LISTBOX控件可以拖放文件就是把外面的文件拖放进LISTBOX记得在VB中打开OLE***哪个属性就可以了VB.NET怎么设置啊谢谢我想只能重载Listbox的DragEnter,DragDrop,DragOver和DragLeave事件就可以了吧在DragDrop事件,或者OnDragDrop函数里面操作。 Protected Overrides Sub OnDragDrop(ByVal drgevent As System.Windows.Forms.DragEventArgs) If drgevent.Effect = DragDropEffects.Copy Then DoYourDropOperator(drgevent.Data) End If End Sub Private SubDoYourDropOperator(ByVal ido As Windows.Forms.IDataObject) Dim ret As String = "" Dim fns(), fn, extn As String If ido.GetDataPresent("FileDrop") = True Then Try fns = ido.GetData("FileDrop") If fns.Length = 1 AndAlso IO.File.Exists(fns(0)) = True Then extn = Methods.GetExtendName(fns(0)) '你的实际操作(extn里面保存了文件名和路径) End If Catch ex As Exception End Try End If Return ret End Function
标签: