Sie sind auf Seite 1von 1

Private Sub Dir1_Change()

File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo DriveErrs
Dir1.Path = Drive1.Drive
Exit Sub
DriveErrs:
Select Case Err
Case 68
MsgBox prompt:="La unidad no est
preparada. Inserte un disco en la unidad.", _
buttons:=vbExclamation
' Restablece la ruta a la unidad anterior.
Drive1.Drive = Dir1.Path
Exit Sub
Case Else
MsgBox prompt:="Error en la aplicacin.", buttons:=vbExclamation
End Select
End Sub
Private Sub File1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
File1.DragIcon = Drive1.DragIcon
File1.Drag
End Sub
Private Sub Form_Load()
frmDrag.Width = 6525
frmDrag.Height = 3075
End Sub
Private Sub Image1_DragDrop(Source As Control, X As Single, Y As Single)
' Obtiene las tres ltimas letras del nombre del archivo arrastrado.
temp = Right$(File1.FileName, 3)
' Si el archivo arrastrado se encuentra en la raz, agrega el nombre del archivo.
If Mid$(File1.Path, Len(File1.Path)) = "\" Then
dropfile = File1.Path & File1.FileName
' Si el archivo arrastrado no se encuentra en la raz, agrega "\" al nombre del archivo.
Else
dropfile = File1.Path & "\" & File1.FileName
End If
Image1.Picture = LoadPicture("")
Select Case UCase$(Trim$(temp))
Case "TXT"
X = Shell("Notepad " + dropfile, 1)
Case "BMP"
Image1.Picture = LoadPicture(dropfile)
Case "EXE"
X = Shell(dropfile, 1)
Case "HLP"
X = Shell("WinHelp " + dropfile, 1)
Case Else
msg = "Pruebe con uno de estos tipos de archivos:"
msg = vbCrLf & msg & vbCrLf & vbCrLf & " .txt, .bmp, .exe, .hlp"
MsgBox msg
End Select
End Sub
Private Sub Image1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Select Case State
Case 0
' Presenta un icono nuevo cuando el origen entra en el rea de colocar.
File1.DragIcon = Dir1.DragIcon
Case 1
' Presenta el DragIcon original cuando el origen sale del rea de colocar.
File1.DragIcon = Drive1.DragIcon
End Select
' Observe que Dir1.DragIcon y Drive1.DragIcon han sido establecidos
' en tiempo de diseo. Esto le permite cargar los iconos "Enter"
' y "Leave" de File1 en tiempo de ejecucin sin que sea necesario
' que el usuario los tenga en el disco.
End Sub

Das könnte Ihnen auch gefallen