VB里怎么实现拖拽效果!!!
VB里怎么实现拖拽效果!!就像西门子PLC软件的拖拽效果一样那种。 我记得好多标准控件就有拖拽和拖拽释放事件,针对事件编程实现你要的拖拽效果好久不用VB了 Private Sub OleDragOver(Data As DataObject, Effect As Long)
If Data.GetFormat(vbCFFiles) Then'判断是否拖入的是否文件格式
Effect = vbDropEffectCopy And Effect
Exit Sub
End If
Effect = vbDropEffectNone
End Sub
Private Sub OleDragDrop(Data As DataObject, Effect As Long)
If Data.GetFormat(vbCFFiles) = True Then '判断是否拖入的是否文件格式
If Right(UCase(Data.Files(1)), 3) = "EXE" Then '判断文件扩展名
TxtFile.Text = Data.Files(1)
End If
End If
End Sub
Private Sub TxtFile_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
OleDragDrop Data, Effect
End Sub
Private Sub TxtFile_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
OleDragOver Data, Effect
End Sub 我已经搞定了,上面的朋友贴的代码是文件的拖拽,我的是实现自定义图标拖拽。
页:
[1]